G
ginge6000
Hi,
I am trying to insert to values into two different fields (USER ID:
and DESK/LAPTOP) in a table (tna feedback). The values come from
forms. I've done this previously and for some reason I can't get it
to work right this time!
Dim SQL As String
Dim stUser As String
Dim stMachine As String
Dim stTable As String
If IsNull(Me.DESK_LAPTOP) Or (Me.DESK_LAPTOP) = "" Then
If 1 = MsgBox("Please enter User ID and Laptop/Desktop into
TNA form", vbOKOnly, "Missing Data!") Then
User_id.SetFocus
stUser = Me.User_id.Text
DoCmd.OpenForm "Frm:TNA_Feedback", , , , , acDialog
stMachine = [Forms]![Frm:TNA_Feedback]![Text3]
stTable = "tna feedback"
SQL = "INSERT INTO'" & stTable & "'(USER ID:, DESK/LAPTOP)
VALUES ('" & stUser & "','" & stMachine & "');"
DoCmd.RunSQL SQL
DoCmd.Close acForm, "Frm:TNA_Feedback"
GoTo Exit_Command25_Click
End If
End If
Every time I run it I get an "Incomplete Query Clause" error message.
What am I doing wrong!
I realise that the table name and field names aren't ideal but someone
else set up the database and to change them would invlove changing a
lot of related queries etc.!
Please help!
Ben
I am trying to insert to values into two different fields (USER ID:
and DESK/LAPTOP) in a table (tna feedback). The values come from
forms. I've done this previously and for some reason I can't get it
to work right this time!
Dim SQL As String
Dim stUser As String
Dim stMachine As String
Dim stTable As String
If IsNull(Me.DESK_LAPTOP) Or (Me.DESK_LAPTOP) = "" Then
If 1 = MsgBox("Please enter User ID and Laptop/Desktop into
TNA form", vbOKOnly, "Missing Data!") Then
User_id.SetFocus
stUser = Me.User_id.Text
DoCmd.OpenForm "Frm:TNA_Feedback", , , , , acDialog
stMachine = [Forms]![Frm:TNA_Feedback]![Text3]
stTable = "tna feedback"
SQL = "INSERT INTO'" & stTable & "'(USER ID:, DESK/LAPTOP)
VALUES ('" & stUser & "','" & stMachine & "');"
DoCmd.RunSQL SQL
DoCmd.Close acForm, "Frm:TNA_Feedback"
GoTo Exit_Command25_Click
End If
End If
Every time I run it I get an "Incomplete Query Clause" error message.
What am I doing wrong!
I realise that the table name and field names aren't ideal but someone
else set up the database and to change them would invlove changing a
lot of related queries etc.!
Please help!
Ben