Selasa, 28 Februari 2012

[MS_AccessPros] Re: Insert Into statement getting syntax error

 

John,

I'm still having trouble. Have separated out the Note portion on its own--that's where the syntax error occurs. The Note field is a memo field. Does that have any relevance?

Here's what I'm using:
CurrentDb.Execute "INSERT INTO ListingsMiscCat (Note) " & _
"VALUES (""ListID = " & Me.ListID & """)", dbFailOnError

Really appreciate the input on using the # signs.

Connie

--- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@...> wrote:
>
> 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