How do you make the DoCmd.RUNSQL "INSERT INTO ...." to recognize a variable that is set in VB code just prior to exectuting the "INSERT INTO" statement?
I use the following code to append a record to a table. I get the "Enter Parameter Value" window for the keyword_temp
field. I know that the keyword_temp value is being set as it is displayed in the MsgBox.
Dim keyword_temp As String
Dim intCurrentRow As Integer
Dim ctlSource As Control
Set ctlSource = frm!lst_applications
For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
keyword_temp = ctlSource.Column(0,IntCurrentRow)
MsgBox (keyword_temp)
'category_temp = "Application"
DoCmd.RunSQL "(INSERT INTO KeyWords(spcr_number, category, keyword) VALUES (Forms![Enter Key Words]![lst_spcr_number], 'Application ', keyword_temp))"
End If
I use the following code to append a record to a table. I get the "Enter Parameter Value" window for the keyword_temp
field. I know that the keyword_temp value is being set as it is displayed in the MsgBox.
Dim keyword_temp As String
Dim intCurrentRow As Integer
Dim ctlSource As Control
Set ctlSource = frm!lst_applications
For intCurrentRow = 0 To ctlSource.ListCount - 1
If ctlSource.Selected(intCurrentRow) Then
keyword_temp = ctlSource.Column(0,IntCurrentRow)
MsgBox (keyword_temp)
'category_temp = "Application"
DoCmd.RunSQL "(INSERT INTO KeyWords(spcr_number, category, keyword) VALUES (Forms![Enter Key Words]![lst_spcr_number], 'Application ', keyword_temp))"
End If