Re: Query an external database...

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Phil Hunt (phung_at_ktintl.com)
Date: 02/25/04


Date: Wed, 25 Feb 2004 09:59:16 -0500

You should run this kind of query using the wizard before using in code.

"Dave" <nomail@nomail.com> wrote in message
news:ON8Kv24%23DHA.2292@TK2MSFTNGP12.phx.gbl...
> shot in the dark ....
>
> "INSERT INTO tblEmployees (FullName, Initials) " & _
> "(SELECT EmpNme, Init " & _
> "FROM tblEmployees " & _
> "IN '" & sOldDBPath & "')"
>
> add braces around the result set
>
>
>
>
> "DIOS" <sindizzy@softhome.net> wrote in message
> news:7d00f3c.0402171112.6d4bc6e9@posting.google.com...
> > Well, I reviewed the SQL and it looks like so:
> >
> > sSQL = "INSERT INTO tblEmployees (FullName, Initials) " & _
> > "SELECT EmpNme, Init " & _
> > "FROM tblEmployees " & _
> > "IN '" & sOldDBPath & "';"
> >
> > CurrentDb.Execute sSQL
> >
> > When I run this inside my Access VBA code I get the error:
> > Runtime error 3134
> > Syntax error in INSERT INTO statement.
> >
> > There has to be a way of doing this. It seems like a simple query to
> > me but I just cant get the right syntax down to work properly.
> >
> > AGP
> >
> >
> >
> > "DIOS" <sindizzy.pak@softhome.net> wrote in message
> news:<0iiXb.176439$U%5.838579@attbi_s03>...
> > > I apologize. The error reported is a synatx error in SQL statement.
> > > I must have skipped that space after the Init field. let me try that
> > > and see how it turns out.
> > >
> > > AGP
> > >
> > > --
> > >
> > > **********************************************************************
> > > Unpak my email address before sending me personal email
> > > **********************************************************************
> > >
> > > "Dirk Goldgar" <dg@NOdataSPAMgnostics.com> wrote in message
> > > news:esjd$dl8DHA.2524@TK2MSFTNGP11.phx.gbl...
> > > > "DIOS" <sindizzy@softhome.net> wrote in message
> > > > news:7d00f3c.0402130810.713699fe@posting.google.com
> > > > > I think that almost works except that my fields are named
> differently
> > > > > so Im trying this and it doesnt seem to work. I can feel im close,
i
> > > > > just have to get the synatax right:
> > > > >
> > > > > sSQL = "INSERT INTO tblGroup (FullName, Initials) " & _
> > > > > "SELECT EmpNme, Init" & _
> > > > > "FROM tblGroup " & _
> > > > > "IN '" & sOldDBPath & "';"
> > > > >
> > > > > CurrentDb.Execute sSQL
> > > > >
> > > > >
> > > > > Its almost driving me insane. I know this should be a pretty easy
> > > > > query but i just cant get it to work right. Ive looked at the help
> and
> > > > > ive searche don google.
> > > >
> > > > You must get in the habit of stating exactly what error message you
> get,
> > > > or how the outcome is different from your expectations, instead of
> > > > simply saying "it doesn't seem to work." In this case, the only
thing
> I
> > > > see that is still wrong in the statement you posted is that you have
> no
> > > > space after the field name "Init". Try this corrected version:
> > > >
> > > > sSQL = "INSERT INTO tblGroup (FullName, Initials) " & _
> > > > "SELECT EmpNme, Init " & _
> > > > "FROM tblGroup " & _
> > > > "IN '" & sOldDBPath & "';"
> > > >
> > > > and report the result.
> > > >
> > > > --
> > > > Dirk Goldgar, MS Access MVP
> > > > www.datagnostics.com
> > > >
> > > > (please reply to the newsgroup)
> > > >
> > > >
>
>



Relevant Pages

  • Re: Please help ~ Syntax Error
    ... If this is not for a query, then you will need to change it to use ... The only time the error stops, see below, but then the report doesn't ... So perhaps I should try another approach, maybe my unbound form wasn't ... Syntax error in query expression '(Between ...
    (microsoft.public.access.formscoding)
  • Re: Calculating totals on a Crosstab Query
    ... you are getting closer qrysheds and qryTotal works ... syntax error in query Expression Count(IIf((Is ... FROM QDailyWheplingReport2 ...
    (microsoft.public.access.reports)
  • Re: Duplicate records ... sort of
    ... the query has come back with a syntax error ... FROM tblRegions as R INNER JOIN tblContacts as C ... FROM tblRegions INNER JOIN tblContacts ON tblRegions.RegionID = ...
    (microsoft.public.access.queries)
  • Re: Can I create a query (or any nifty easy way) to do this?
    ... I get is a syntax error for your example. ... The update query though still doesn't work at all. ... entry to Titles - that gives ... >>Basically the Furniture Table is a list of all possible ...
    (microsoft.public.access.queries)
  • Re: Combo box troubles
    ... I did use the query bldr ... under "Record Source" The form works fine. ... The syntax error come up in the combo box wizard after ...
    (microsoft.public.access.formscoding)