L
Lindsey M
Hi everyone, hope you are well
I have the following code for my command button, but when I click the "OK"
button, an error comes up with the following
Run time error 2447
Here is my code:
Private Sub cmdOK_Click()
Dim strSQL As String
Dim sUserID As String
Dim sRoomID As String
Dim dDate As Date
Dim StartTime As String
Dim EndTime As String
strSQL = "Select * from tblSchedule"
sUserID = Me.txtUser
sRoomID = Me.cmbRoomReq
StartTime = Me.lstStart
EndTime = Me.lstEnd
Me.lstConflict.Requery
If Me.lstConflict.ListCount > 0 Then
MsgBox "Sorry, no can do!"
Else
DoCmd.RunSQL "INSERT INTO tblSchedule " & _
"(UserID, RoomID, Date, StartTime, EndTime) " & _
"VALUES (" & sUserID & ", " & sRoomID & ", #" & _
dDate & "#, #" & StartTime & "#, #" & EndTime & "#)"
End If
End Sub
Can anyone tell me where I might be going wrong here?
Cheers
Lindsey
p.s., when i click on the Help button on the error box that appears, it
doesn't seem to be working so i can't figure out where the problem lays
I have the following code for my command button, but when I click the "OK"
button, an error comes up with the following
Run time error 2447
Here is my code:
Private Sub cmdOK_Click()
Dim strSQL As String
Dim sUserID As String
Dim sRoomID As String
Dim dDate As Date
Dim StartTime As String
Dim EndTime As String
strSQL = "Select * from tblSchedule"
sUserID = Me.txtUser
sRoomID = Me.cmbRoomReq
StartTime = Me.lstStart
EndTime = Me.lstEnd
Me.lstConflict.Requery
If Me.lstConflict.ListCount > 0 Then
MsgBox "Sorry, no can do!"
Else
DoCmd.RunSQL "INSERT INTO tblSchedule " & _
"(UserID, RoomID, Date, StartTime, EndTime) " & _
"VALUES (" & sUserID & ", " & sRoomID & ", #" & _
dDate & "#, #" & StartTime & "#, #" & EndTime & "#)"
End If
End Sub
Can anyone tell me where I might be going wrong here?
Cheers
Lindsey
p.s., when i click on the Help button on the error box that appears, it
doesn't seem to be working so i can't figure out where the problem lays