Hi guys,
table involved is called [Schedule Details] >> i know its not good to do this now
I keep getting an error 3464 with the update section.
Heres the code:
Private Sub InputClose_Click()
DoCmd.SetWarnings False
Dim strSQL1 As String
Dim strSQL2 As String
Dim ArgID As String
Dim ArgRoom As String
Dim ArgStart As Date
Dim ArgEnd As Date
Dim ArgCon As String
Dim NameCheck As String
ArgID = Forms!AvailDisplayInput![DisplayStudentIDlbl]
ArgRoom = Forms!AvailDisplayInput![DisplayRoomIDlbl]
ArgStart = Forms!AvailDisplayInput![DisplayStartDatelbl]
ArgEnd = Forms!AvailDisplayInput![DisplayEndDatelbl]
ArgCon = Forms!AvailDisplayInput![Statuslbl]
strSQL1 = "INSERT INTO [Schedule Details]( StudentID,RoomID,StartDate,EndDate,Confirmed ) VALUES ('" & ArgID & "','" & ArgRoom & "', '" & ArgStart & "', '" & ArgEnd & "','" & ArgCon & "')"
strSQL2 = "UPDATE [Schedule Details] SET [Schedule Details].StudentID = '" & ArgID & "'," & _
"[Schedule Details].RoomID = '" & ArgRoom & "'," & _
"[Schedule Details].StartDate = '" & ArgStart & "'," & _
"[Schedule Details].EndDate = '" & ArgEnd & "'," & _
"[Schedule Details].Confirmed = '" & ArgCon & "' WHERE ([Schedule Details].StudentID = '" & ArgID & "')"
If Not (IsNull(DLookup("StudentID", "[Schedule Details]", "[Schedule Details].StudentID = " & Forms!AvailDisplayInput!DisplayStudentIDlbl & ""))) Then
DoCmd.RunSQL strSQL2 <<<<<<<<<heres where it stops
Else
DoCmd.RunSQL strSQL1
DoCmd.close acForm, "AvailDisplayInput"
DoCmd.SetWarnings True
End If
Can anyone see where I'm going wrong its been driving me mad
table involved is called [Schedule Details] >> i know its not good to do this now
I keep getting an error 3464 with the update section.
Heres the code:
Private Sub InputClose_Click()
DoCmd.SetWarnings False
Dim strSQL1 As String
Dim strSQL2 As String
Dim ArgID As String
Dim ArgRoom As String
Dim ArgStart As Date
Dim ArgEnd As Date
Dim ArgCon As String
Dim NameCheck As String
ArgID = Forms!AvailDisplayInput![DisplayStudentIDlbl]
ArgRoom = Forms!AvailDisplayInput![DisplayRoomIDlbl]
ArgStart = Forms!AvailDisplayInput![DisplayStartDatelbl]
ArgEnd = Forms!AvailDisplayInput![DisplayEndDatelbl]
ArgCon = Forms!AvailDisplayInput![Statuslbl]
strSQL1 = "INSERT INTO [Schedule Details]( StudentID,RoomID,StartDate,EndDate,Confirmed ) VALUES ('" & ArgID & "','" & ArgRoom & "', '" & ArgStart & "', '" & ArgEnd & "','" & ArgCon & "')"
strSQL2 = "UPDATE [Schedule Details] SET [Schedule Details].StudentID = '" & ArgID & "'," & _
"[Schedule Details].RoomID = '" & ArgRoom & "'," & _
"[Schedule Details].StartDate = '" & ArgStart & "'," & _
"[Schedule Details].EndDate = '" & ArgEnd & "'," & _
"[Schedule Details].Confirmed = '" & ArgCon & "' WHERE ([Schedule Details].StudentID = '" & ArgID & "')"
If Not (IsNull(DLookup("StudentID", "[Schedule Details]", "[Schedule Details].StudentID = " & Forms!AvailDisplayInput!DisplayStudentIDlbl & ""))) Then
DoCmd.RunSQL strSQL2 <<<<<<<<<heres where it stops

Else
DoCmd.RunSQL strSQL1
DoCmd.close acForm, "AvailDisplayInput"
DoCmd.SetWarnings True
End If
Can anyone see where I'm going wrong its been driving me mad