Auto form field updates....problem..hmmm?

paulmcdonnell

Ready to Help
Local time
Today, 10:40
Joined
Apr 11, 2001
Messages
167
Hi guys..>!!

I'm using code to auto update 5 address fields from a company name selected from a combo box on my form. The after update event is the one i'm using...

the code is short ...Dim dbf As Recordset, qdf As QueryDef, Strsql As String
Strsql = "Select * from [Company Benefits] Where " & "[Company] =" & Me![Company]
Set dbf = CurrentDb.OpenRecordset(Strsql)
Me!Address_1 = dbf![Address_1]
Me!Address_2 = dbf![Address_2]
Me!Address_3 = dbf![Address_3]
Me!Town = dbf![Town]
Me!Postcode = dbf![Postcode]

However this worked fine initially now I'm getting...


Run time error 3075
Syntax Error (missing operator in query expression '[Company] = 'ABC'

Now, I can't find out what this problem is, especially when it worked fine a while ago..

Any ideas

Cheers
Paul
 
see if my correction works:

Strsql = "Select * from [Company Benefits] Where " & "[Company] ='" & Me![Company] & "';"
 

Users who are viewing this thread

Back
Top Bottom