D
David
Hi I am using a query to update different types of data.
for some reason I just can't get past this
for the code below everything works except the ReportTime, ETD and ETA
fields. It keeps coming up with error 13 type mismatch
I have tried putting those cases everywhere and even buy themselves but
nothing is working
Private Sub bttn_DOIT_Click()
On Error GoTo err_bttn_DOIT_Click
Dim sqlString As String
Dim TableRef As String
Dim WhereRef As String
Dim ChangeRef As String
TableRef = "Pax." & Me.combo_Field
WhereRef = "Pax.FlightNo=" & Me.txt_FlightNo & " AND Pax.FlightDate=#" &
Me.txt_Date & "#"
If Me.check_Destination = True Then
WhereRef = WhereRef + " AND Pax.Destination='" &
Me.combo_Destination & "'"
End If
Select Case Me.combo_Field
Case "FlightNo"
ChangeRef = Me.txt_ChangeTo
Case "Destination"
ChangeRef = "'" & Me.txt_ChangeTo & "'"
Case "FlightDate" Or "ReportTime" Or "ETD" Or "ETA"
ChangeRef = "#" & Me.txt_ChangeTo & "#"
End Select
sqlString = "UPDATE Pax SET " & TableRef & "=" & ChangeRef & " WHERE " &
WhereRef & ";"
DoCmd.RunSQL sqlString
exit_bttn_DOIT_Click:
Exit Sub
err_bttn_DOIT_Click:
MsgBox "ThisError " & Err.Number & Err.Description
Resume exit_bttn_DOIT_Click
End Sub
what am I doing wrong??
David
for some reason I just can't get past this
for the code below everything works except the ReportTime, ETD and ETA
fields. It keeps coming up with error 13 type mismatch
I have tried putting those cases everywhere and even buy themselves but
nothing is working
Private Sub bttn_DOIT_Click()
On Error GoTo err_bttn_DOIT_Click
Dim sqlString As String
Dim TableRef As String
Dim WhereRef As String
Dim ChangeRef As String
TableRef = "Pax." & Me.combo_Field
WhereRef = "Pax.FlightNo=" & Me.txt_FlightNo & " AND Pax.FlightDate=#" &
Me.txt_Date & "#"
If Me.check_Destination = True Then
WhereRef = WhereRef + " AND Pax.Destination='" &
Me.combo_Destination & "'"
End If
Select Case Me.combo_Field
Case "FlightNo"
ChangeRef = Me.txt_ChangeTo
Case "Destination"
ChangeRef = "'" & Me.txt_ChangeTo & "'"
Case "FlightDate" Or "ReportTime" Or "ETD" Or "ETA"
ChangeRef = "#" & Me.txt_ChangeTo & "#"
End Select
sqlString = "UPDATE Pax SET " & TableRef & "=" & ChangeRef & " WHERE " &
WhereRef & ";"
DoCmd.RunSQL sqlString
exit_bttn_DOIT_Click:
Exit Sub
err_bttn_DOIT_Click:
MsgBox "ThisError " & Err.Number & Err.Description
Resume exit_bttn_DOIT_Click
End Sub
what am I doing wrong??
David