Re: Query an external database...
From: Phil Hunt (phung_at_ktintl.com)
Date: 02/25/04
- Next message: Green Xiar: "Does Access Support Binary And/Or/Xor ?"
- Previous message: Dave: "Re: Query an external database..."
- In reply to: Dave: "Re: Query an external database..."
- Next in thread: david epsom dot com dot au: "Re: Query an external database..."
- Messages sorted by: [ date ] [ thread ]
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)
> > > >
> > > >
>
>
- Next message: Green Xiar: "Does Access Support Binary And/Or/Xor ?"
- Previous message: Dave: "Re: Query an external database..."
- In reply to: Dave: "Re: Query an external database..."
- Next in thread: david epsom dot com dot au: "Re: Query an external database..."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|