I'm trying to use a value from a Recordset as part of a string statement. When the code executes, I get the error message, too few parameters.
Dim db As Database
Dim strSQL As String
Dim rsinfo As Recordset
Dim slic As String
Set db = CurrentDb
strSQL = "SELECT * FROM zCenterList;"
Set rsinfo = db.OpenRecordset(strSQL)
rsinfo.MoveFirst
Do While Not rsinfo.EOF
slic = Trim(rsinfo.Fields("SLIC"
)
'slic = "3040"
strSQL = "INSERT INTO zMaster_CBX ( SLIC, DEL_DATE )SELECT tim1" & slic & ".SLIC, tim13040.DEL_DATE, cbx3040.* FROM cbx3040 INNER JOIN tim13040 ON cbx3040.DISP_ID = tim13040.DISP_ID;"
CurrentDb.Execute (strSQL)
rsinfo.MoveNext
Loop
I can manually set the variable slic equal to a value (Ex. 3040) and it runs fine, I can set other variables in the string and it runs fine. It just will not work when using a value from the recordset. Any thoughts would be appreciated.
Ron
Dim db As Database
Dim strSQL As String
Dim rsinfo As Recordset
Dim slic As String
Set db = CurrentDb
strSQL = "SELECT * FROM zCenterList;"
Set rsinfo = db.OpenRecordset(strSQL)
rsinfo.MoveFirst
Do While Not rsinfo.EOF
slic = Trim(rsinfo.Fields("SLIC"
'slic = "3040"
strSQL = "INSERT INTO zMaster_CBX ( SLIC, DEL_DATE )SELECT tim1" & slic & ".SLIC, tim13040.DEL_DATE, cbx3040.* FROM cbx3040 INNER JOIN tim13040 ON cbx3040.DISP_ID = tim13040.DISP_ID;"
CurrentDb.Execute (strSQL)
rsinfo.MoveNext
Loop
I can manually set the variable slic equal to a value (Ex. 3040) and it runs fine, I can set other variables in the string and it runs fine. It just will not work when using a value from the recordset. Any thoughts would be appreciated.
Ron