G
Guest
Hi,
Behind the "On Change" event on a form field I've inserted a DoCMD.RUNSQL as
below, but it's just giving me a run time error 2342 - A RUNSQL action
requires an argument consisting of an SQL statement.
As a sanity check I've pasted the SQL into the query builder SQL viewer and
it runs perfectly.
I've check that variable Location_Code contains a value. Has anyone got any
ideas that I can try?
Thanks.
Dim Location_Code, SQL, Phone_code
Phone_Code = ""
SQL = ""
Location_Code = [Location]
DoCmd.RunSQL "SELECT [All Support Logs].[Log No] FROM [All Support Logs] " & _
"WHERE [All Support Logs].[Log No] = " ' " & Location_Code & "
' "
Phone_code = [Locations].[Phone Code]
msgbox Phone_code
Behind the "On Change" event on a form field I've inserted a DoCMD.RUNSQL as
below, but it's just giving me a run time error 2342 - A RUNSQL action
requires an argument consisting of an SQL statement.
As a sanity check I've pasted the SQL into the query builder SQL viewer and
it runs perfectly.
I've check that variable Location_Code contains a value. Has anyone got any
ideas that I can try?
Thanks.
Dim Location_Code, SQL, Phone_code
Phone_Code = ""
SQL = ""
Location_Code = [Location]
DoCmd.RunSQL "SELECT [All Support Logs].[Log No] FROM [All Support Logs] " & _
"WHERE [All Support Logs].[Log No] = " ' " & Location_Code & "
' "
Phone_code = [Locations].[Phone Code]
msgbox Phone_code