Re: Problem with INSERT INTO (SQL) statement in VBA
- From: "Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx>
- Date: Wed, 28 Nov 2007 15:45:47 -0500
You might also use
Dim strSQL As String
strSQL = "INSERT INTO tblEmp " & _
"(empName, Group, LOCATION, [Group Name], Title, Start_Date) " & _
"VALUES(""" & Forms!Form_AddUser!fname & ' ' & _
Forms!Form_AddUser!lname & """, """ & _
Forms!Form_AddUser!group & """, " & loc & ", """ & _
Forms!Form_AddUser!GName & """, """ & _
Forms!Form_AddUser!title & """, " & _
Format(Forms!Form_AddUser!DTPicker1, "\#yyyy\-mm\-dd\#") & ")"
Debug.Print strSQL
DoCmd.RunSQL strSQL
Once the code runs (and fails), go to the Immediate Window (Ctrl-G) and post
back what appears there.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Ken Snell (MVP)" <kthsneisllis9@xxxxxxxxxxxxxxxxxx> wrote in message
news:O8ri9ofMIHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
Post the code that you now have; likely there is a typo still.
--
Ken Snell
<MS ACCESS MVP>
"ruchie" <ruchie.sharma@xxxxxxxxx> wrote in message
news:4e06aa61-c94c-4f50-99c2-a10b76487bc5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Ken/Douglas,
I tried your methods, but it is still giving me the same run-time
error (3134 - syntax error in INSERT INTO statement).
Also, i do want to mention that 'loc' is a numeric field.
please guide me how to make this work!
thanks a lot guys
.
- References:
- Problem with INSERT INTO (SQL) statement in VBA
- From: ruchie
- Re: Problem with INSERT INTO (SQL) statement in VBA
- From: Ken Snell \(MVP\)
- Re: Problem with INSERT INTO (SQL) statement in VBA
- From: ruchie
- Re: Problem with INSERT INTO (SQL) statement in VBA
- From: Ken Snell \(MVP\)
- Problem with INSERT INTO (SQL) statement in VBA
- Prev by Date: RE: Creating a query using multiselect list box and text boxes
- Next by Date: Re: Locked database
- Previous by thread: Re: Problem with INSERT INTO (SQL) statement in VBA
- Next by thread: Re: Problem with INSERT INTO (SQL) statement in VBA
- Index(es):
Relevant Pages
|