Error 3075 in code

A

Ayo

I am geeting a -- Syntax error in query expression '850_Gain_dBi' -- error on
this line of code:
Me.txt_HBW_A_EC = DLookup("850_Horiz_BW", "qry_AntennaTable", "Ant_Model ='"
& Me.cmbAnt_A_EC & "'" & "And" & MyPos > 0)

Any ideas why?
Thanks
 
A

Ayo

That was how I initially had it before changing it to the current format. I
was still getting the same error.
 
D

Douglas J. Steele

Assuming MyPos is a field in qry_AntennaTable, it needs to be inside the
quotes:

Me.txt_HBW_A_EC = DLookup("850_Horiz_BW", "qry_AntennaTable", "Ant_Model ='"
& Me.cmbAnt_A_EC & "' And MyPos > 0")

If it's not a field in the query, but a VBA error instead, it shouldn't be
in the DLookup: you should decide whether or not to bother with the DLookup
depending on its value:

If MyPos > 0 Then
Me.txt_HBW_A_EC = DLookup("850_Horiz_BW", "qry_AntennaTable", "Ant_Model
='" & Me.cmbAnt_A_EC & "'")
End If
 
Top