Question : Why do I get a Run time error '2342' A RunSQL action requires an argument consisting of a SQL statement ?

Why does the following SQL statement work fine in the form load:

str_sql1 = "DELETE from tblExACS"
DoCmd.RunSQL (str_sql1)
--------------------------------------------------------------------------------------------------------------
Yet when I execute the following SQL statement in the form load, I get an error message
Run time error '2342'
A RunSQL action requires an argument consisting of a SQL statement

str_sql1 = "SELECT top 1 right([Acct Number],6) As intCustomer, left([Acct Number],4) As intOffice from tblSpACS order by intOffice"
DoCmd.RunSQL (str_sql1)

This SQL statement executes fine in the SQL Query Analyzer.

Answer : Why do I get a Run time error '2342' A RunSQL action requires an argument consisting of a SQL statement ?

Have you set the rowsource of cmbOffice successfully?

Then
Me.cmbOffice = Me.cmbOffice.ItemData(0)
Random Solutions  
 
programming4us programming4us