Senin, 27 Februari 2012

RE: [MS_AccessPros] Insert Into statement getting syntax error

 

Connie-

Like this:

CurrentDb.Execute "INSERT INTO ListingsMiscCat (ListID, MiscCatID, MiscCatDate,
Note) " & _
"VALUES (" & Me.ReListID & ", 5, #" & Me.ListDate & "#, ""ListID = " &
Me.ListID & """)", _
dbFailOnError

Note that I also surrounded the date literal with #.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Kirkland, WA)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of mrsgoudge
Sent: Monday, February 27, 2012 2:13 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Insert Into statement getting syntax error

Hi all! Hope your day is going well. I have checked out the following
statement and it's the last value that is giving me the problem. It is to be
put into the Note and would look like: ListID = 832

I've tried several different approaches and can't get it to work. My guess is
that I have more to learn about using quotations.

CurrentDb.Execute "INSERT INTO ListingsMiscCat (ListID, MiscCatID, MiscCatDate,
Note) VALUES (" & Me.ReListID & ", 5, " & Me.ListDate & ", ""ListID = """ &
Me.ListID & ")", dbFailOnError

Thanks!
Connie

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar