Good morning, all:
I'm not sure this is exactly the right forum. Please, feel free to move/transfer it to a more appropriate forum.
I'm trying to program a button on a form, to run a SQL statement, that will insert records into a table.
And, I'm wracking my brains: It appears to compose the SQL statement just fine. (I present an Msgbox immediately before the docmd.runSQL line.) But, when I run it, I get neither the new record, nor an error.
A couple points to consider:
1) I have double-checked that the number of values I'm trying to employ does match the number (and data-type) of fields in the table.
2) This code is (of course) part of a larger routine. At the beginning of this routine, I delete any existing table "TmpFollowupSamples", and I recreate the table. Is there any kind of "save" function that I need to perform on a newly-created table, before populating it.
Here's my code (below). Any input would be appreciated.
Cliff
==============================
START CODE
==============================
' This first component contains the columns FarmID, AnimalID, CompiledQtrs
strSQL = "INSERT INTO TmpFollowUpSamples " & _
"VALUES (" & _
rs1.Fields("FarmID") & ", " & _
rs1.Fields("PersonResponsible") & ", " & _
"'" & rs1.Fields("AnimalID") & "', " & _
"'" & rs1.Fields("CompiledQtrs") & "', " & _
"'', '', '', '', '', '', '');"
MsgBox strSQL
DoCmd.RunSQL strSQL
DoCmd.OpenTable "TmpFollowUpSamples"
==============================
END CODE
==============================