I create a SQL statement in VBA which translates to:
SELECT tblInvData.Class FROM tblInvData GROUP BY tblInvData.Class WHERE Class >= '11' ORDER BY tblInvData.Class
The original VBA code, in the cmbFrom AfterUpdate event, is
.RowSource = "SELECT tblInvData.Class FROM tblInvData " _
& "GROUP BY tblInvData.Class WHERE Class >= '" & Me.cmbFrom.Value _
& "' ORDER BY tblInvData.Class "
.ColumnCount = 1
.BoundColumn = 1
When I run the program, I keep getting an error message as follows:
Syntax error (missing operator) in query expression 'tblInvData.Class WHERE Class >='11".
implying that I'm missing my closing single quote. I'm not, though, as both my VBA code and the Immediate Window results prove. What's going on?
Can you Debug.Print the RowSource and paste it back to a query
hope this help
See clear as mud
the aim is store once, not store multiple times
Remember... Optimize 'til you die!
Progaming environment: Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010 VB based on my own environment: vb6 sp5 ASP based on my own environment: 5.6 VB-NET based on my own environment started 2007 SQL-2005 based on my own environment started 2008 MYLE YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.
I'm not sure what you mean. The first line I posted was the result of a Debug.Print. What do you mean 'paste it back to a query?'
He means Debug.Print the query to the Immediate Window and then copy it from the Immediate window back into a query (or a query analyzer tool or however you like) and run the query to see if it executes - but Teddy is right, check the order of your clauses ...