Error 3075 in code

  • Thread starter Thread starter Ayo
  • Start date Start date
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
 
That was how I initially had it before changing it to the current format. I
was still getting the same error.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top