T
troubledstudent
I have a SQL query in which I want the user to select a table to update. All
definitions and column headings in the table are identical, but the data is
different. I keep getting a syntax error in which I have tried to debug but
I keep getting the same error. Any suggestions? Thanks
Private Sub rec_add_Click()
Dim sqladd As String
sportclub = Me.text1.Value
sqladd = "INSERT INTO " & sportclub & " (Name, [Birth Date], Phone, Gender,
Email, [Campus Address]" & _
", City, State, Zip, [School ID #], [Emergency Contact], [Emergency Phone],
" & _
"[# of years in club], [Years in School], Barometer, Flyer, Website, Friend,
" & _
"[Rec Sport Staff], Other, [Social Interaction], [Stress Reduction], Fun, "
& _
"[Physical Fitness], [Learn New Skill], [Gain Knowledge], [Leadership
Skills], " & _
"[Other Reason])" & _
" Values (""" & Me.text2.Value & """, """ & Me.text3.Value & """, " & _
"""" & Me.text4.Value & """, """ & Me.text5.Value & """, """ &
Me.text6.Value & """, " & _
"""" & Me.text7.Value & """, """ & Me.text8.Value & """, """ &
Me.text9.Value & """, " & _
"""" & Me.text10.Value & """, """ & Me.text11.Value & """, """ &
Me.text12.Value & """, " & _
"""" & Me.text13.Value & """, """ & Me.text14.Value & """, " & Me.opt1.Value
& ", " & _
"" & Me.opt3.Value & ", " & Me.opt5.Value & ", " & Me.opt2.Value & ", " &
Me.opt4.Value & ", " & _
"" & Me.opt6.Value & ", " & Me.opt7.Value & ", " & Me.opt9.Value & ", " &
Me.opt11.Value & ", " & _
"" & Me.opt8.Value & ", " & Me.opt10.Value & ", " & Me.opt12.Value & ", " &
Me.opt13.Value & ", " & _
"" & Me.opt14.Value & ")"
DoCmd.RunSQL sqladd
definitions and column headings in the table are identical, but the data is
different. I keep getting a syntax error in which I have tried to debug but
I keep getting the same error. Any suggestions? Thanks
Private Sub rec_add_Click()
Dim sqladd As String
sportclub = Me.text1.Value
sqladd = "INSERT INTO " & sportclub & " (Name, [Birth Date], Phone, Gender,
Email, [Campus Address]" & _
", City, State, Zip, [School ID #], [Emergency Contact], [Emergency Phone],
" & _
"[# of years in club], [Years in School], Barometer, Flyer, Website, Friend,
" & _
"[Rec Sport Staff], Other, [Social Interaction], [Stress Reduction], Fun, "
& _
"[Physical Fitness], [Learn New Skill], [Gain Knowledge], [Leadership
Skills], " & _
"[Other Reason])" & _
" Values (""" & Me.text2.Value & """, """ & Me.text3.Value & """, " & _
"""" & Me.text4.Value & """, """ & Me.text5.Value & """, """ &
Me.text6.Value & """, " & _
"""" & Me.text7.Value & """, """ & Me.text8.Value & """, """ &
Me.text9.Value & """, " & _
"""" & Me.text10.Value & """, """ & Me.text11.Value & """, """ &
Me.text12.Value & """, " & _
"""" & Me.text13.Value & """, """ & Me.text14.Value & """, " & Me.opt1.Value
& ", " & _
"" & Me.opt3.Value & ", " & Me.opt5.Value & ", " & Me.opt2.Value & ", " &
Me.opt4.Value & ", " & _
"" & Me.opt6.Value & ", " & Me.opt7.Value & ", " & Me.opt9.Value & ", " &
Me.opt11.Value & ", " & _
"" & Me.opt8.Value & ", " & Me.opt10.Value & ", " & Me.opt12.Value & ", " &
Me.opt13.Value & ", " & _
"" & Me.opt14.Value & ")"
DoCmd.RunSQL sqladd