I am trying to use a variable, TempS, in the Where Clause. I keep getting error 2147217904 (80040e 10Y: - No Value given for one or more of the parameters (in the open statement).
When I substitute the actual number, 5400 for TempS. Everything works fine, the record is located and the date and id are updated. Do I have to encapsulate the variable name some how? Also, I did check the value of the variable and it was 5400. Any suggestions?
Thanks,
Jeff
UPDATE: I Changed "MSNumber = TempS" to "MSNumber = " & TempS and everything worked.
Code:
Sub LogDateEdited(CurrentshelterNumber) ' Under construction
Dim TempS As Integer
TempS = [SNumber]
If MsgBox("HAVE YOU UPDATED THE POINTS OF CONTACT? " & Chr(10) _
& "Note: YES will date stamp 'POCs Last Edited' with " _
& "today's date", vbYesNo + vbQuestion) = vbYes Then
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM tblLastModified WHERE " & _
"MSNumber = TempS", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
rs![MEditDate].Value = Date
rs![MEditId] = TempVars!tempLoginName
Debug.Print rs![MSNumber]
Debug.Print rs![MEditDate]
Debug.Print CurrentshelterNumber
rs.Update
rs.CLOSE
End If
End Sub