Hi! I have an Access 2000 db running on a Windows 95 machine on an 2000 server/Novell environment. I have several working functions that build SQL statements from forms and pass the sql to query defs. However, on
Wednesday Sept 25 all new function I wrote are not passing the SQL on (I get an error message "3129 invalid sql statement). Here's the code for the simplest query without error trapping:
BuildBiasGreaterOne2 (this is the function that builds the SQL string for one of the queries):
Function BuildBiasGreaterOne2(strSQL9 As String) As Boolean
Dim strSelect As String
Dim strFrom As String
Dim strWhere As String
strSelect = "SELECT qryBiasGreaterOne1.PRODUCT_CODE, "
strSelect = strSelect & "qryBiasGreaterOne1.PRODUCT_DESC, "
strSelect = strSelect & "qryBiasGreaterOne1.GrandU, "
strSelect = strSelect & "qryBiasGreaterOne1.GrandDesc, "
strSelect = strSelect & "qryBiasGreaterOne1.SALES_DATE, "
strSelect = strSelect & "qryBiasGreaterOne1.ABS_FCST_VAR, "
strSelect = strSelect & "qryBiasGreaterOne1.ABS_FCST_VAR_PCT, "
strSelect = strSelect & "qryBiasGreaterOne1.GLOBAL, "
strSelect = strSelect & "qryBiasGreaterOne1.BIAS, "
strSelect = strSelect & "qryBiasGreaterOne1.Diff"
strFrom = " FROM qryBiasGreaterOne1"
strWhere = " WHERE ((qryBiasGreaterOne1.BIAS)>1) AND ((qryBiasGreaterOne1.Diff)<4)"
strSQL9 = strSelect & vbCr & strFrom & vbCr & strWhere
MsgBox strSQL9
Debug.Print strSQL9
BuildBiasGreaterOne2 = True
End Function
Note that when I debug.print the SQL and paste it into a new query, the query runs, so the problem is not whether or not the SQL is being built, or if it is invalid.
Here's the code for the query def that strSQL9 is being passed to:
Function MakeBiasGreaterOne2(strSQL9 As String) As Boolean
Dim qdf As QueryDef
Set qdf = CurrentDb.CreateQueryDef("qryBiasGreaterOne2"
qdf.SQL = strSQL9
qdf.Close
RefreshDatabaseWindow
MakeBiasGreaterOne2 = True
The query def runs - it just makes an empty query. Any ideas about what's going on? Do you see any code problems? The 10 query defs I made before Sept 25 still work fine, it's just all the ones I made since then that don't work.
Gladys
Wednesday Sept 25 all new function I wrote are not passing the SQL on (I get an error message "3129 invalid sql statement). Here's the code for the simplest query without error trapping:
BuildBiasGreaterOne2 (this is the function that builds the SQL string for one of the queries):
Function BuildBiasGreaterOne2(strSQL9 As String) As Boolean
Dim strSelect As String
Dim strFrom As String
Dim strWhere As String
strSelect = "SELECT qryBiasGreaterOne1.PRODUCT_CODE, "
strSelect = strSelect & "qryBiasGreaterOne1.PRODUCT_DESC, "
strSelect = strSelect & "qryBiasGreaterOne1.GrandU, "
strSelect = strSelect & "qryBiasGreaterOne1.GrandDesc, "
strSelect = strSelect & "qryBiasGreaterOne1.SALES_DATE, "
strSelect = strSelect & "qryBiasGreaterOne1.ABS_FCST_VAR, "
strSelect = strSelect & "qryBiasGreaterOne1.ABS_FCST_VAR_PCT, "
strSelect = strSelect & "qryBiasGreaterOne1.GLOBAL, "
strSelect = strSelect & "qryBiasGreaterOne1.BIAS, "
strSelect = strSelect & "qryBiasGreaterOne1.Diff"
strFrom = " FROM qryBiasGreaterOne1"
strWhere = " WHERE ((qryBiasGreaterOne1.BIAS)>1) AND ((qryBiasGreaterOne1.Diff)<4)"
strSQL9 = strSelect & vbCr & strFrom & vbCr & strWhere
MsgBox strSQL9
Debug.Print strSQL9
BuildBiasGreaterOne2 = True
End Function
Note that when I debug.print the SQL and paste it into a new query, the query runs, so the problem is not whether or not the SQL is being built, or if it is invalid.
Here's the code for the query def that strSQL9 is being passed to:
Function MakeBiasGreaterOne2(strSQL9 As String) As Boolean
Dim qdf As QueryDef
Set qdf = CurrentDb.CreateQueryDef("qryBiasGreaterOne2"
qdf.SQL = strSQL9
qdf.Close
RefreshDatabaseWindow
MakeBiasGreaterOne2 = True
The query def runs - it just makes an empty query. Any ideas about what's going on? Do you see any code problems? The 10 query defs I made before Sept 25 still work fine, it's just all the ones I made since then that don't work.
Gladys