compile error: object required- - - -Help!
On a form I am trying to update a table with Month and Year that user chooses. I did a test and know that the date from the form is coming through good. The error I get is a compile error object required on the Set stSQL = "......."
Private Sub cmdStartForm_Click()
If (Me![lstMonth].Value = Null) Then
MsgBox "Please highlight a Month.", vbOKOnly
End If
If (Me![lstYear].Value = Null) Then
MsgBox "Please highlight a Year.", vbOKOnly
End If
Dim con As Object
Dim rs As Object
Dim stSQL As String
Dim intOption As Integer
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("adodb.recordset")
Set stSQL = "UPDATE [Basin_Supplemental_Demand]SET [month] = " & Me![lstMonth].Value & ", [year] = " & Me![lstYear].Value & "WHERE bsdID=1;"
rs.Open stSQL, con, 1 '1 = adOpenKeyset
Thanks for the help!!!!
On a form I am trying to update a table with Month and Year that user chooses. I did a test and know that the date from the form is coming through good. The error I get is a compile error object required on the Set stSQL = "......."
Private Sub cmdStartForm_Click()
If (Me![lstMonth].Value = Null) Then
MsgBox "Please highlight a Month.", vbOKOnly
End If
If (Me![lstYear].Value = Null) Then
MsgBox "Please highlight a Year.", vbOKOnly
End If
Dim con As Object
Dim rs As Object
Dim stSQL As String
Dim intOption As Integer
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("adodb.recordset")
Set stSQL = "UPDATE [Basin_Supplemental_Demand]SET [month] = " & Me![lstMonth].Value & ", [year] = " & Me![lstYear].Value & "WHERE bsdID=1;"
rs.Open stSQL, con, 1 '1 = adOpenKeyset
Thanks for the help!!!!