S
SirPoonga
I created a query using the query builder. I took the SQL of it and
put it into VBA code. I replaced one of the WHERE clause fields with a
variable. Here's teh SQL
sqlcmd = "SELECT [01_BOM_Record].[ID_ITEM_PAR],
[ITMMAS_BASE].[ID_ITEM], [ITMMAS_BASE].[DESCR_1] " & _
"FROM [01_BOM_Record] INNER JOIN [ITMMAS_BASE] ON
[01_BOM_Record].[ID_ITEM_COMP] = [ITMMAS_BASE].[ID_ITEM] " & _
"WHERE [01_BOM_Record].[ID_ITEM_PAR]=""" & mybucket & """ AND
[ITMMAS_BASE].[DESCR_1] Like ""*MOLDBOARD*"""
rs2.Open sqlcmd, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
reccount = rs2.RecordCount
If I put a breakpoint as the rs2.open line and in the intermediate
window do a "print sqlcmd" I get a valid sql string. I take that
string and put it in the query builder. It runs fine, it returns the
two records for that part. But in code it returns 0 records. Any
ideas?
put it into VBA code. I replaced one of the WHERE clause fields with a
variable. Here's teh SQL
sqlcmd = "SELECT [01_BOM_Record].[ID_ITEM_PAR],
[ITMMAS_BASE].[ID_ITEM], [ITMMAS_BASE].[DESCR_1] " & _
"FROM [01_BOM_Record] INNER JOIN [ITMMAS_BASE] ON
[01_BOM_Record].[ID_ITEM_COMP] = [ITMMAS_BASE].[ID_ITEM] " & _
"WHERE [01_BOM_Record].[ID_ITEM_PAR]=""" & mybucket & """ AND
[ITMMAS_BASE].[DESCR_1] Like ""*MOLDBOARD*"""
rs2.Open sqlcmd, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
reccount = rs2.RecordCount
If I put a breakpoint as the rs2.open line and in the intermediate
window do a "print sqlcmd" I get a valid sql string. I take that
string and put it in the query builder. It runs fine, it returns the
two records for that part. But in code it returns 0 records. Any
ideas?