I am trying to add the below SQL Query into VB. It seems to fall down on the
"Where" definition.
Can anyone see where I've gone wrong?
Function AppendCpartyYesterday()
CurrentDb.Execute "INSERT INTO tblCpartyYesterday ( Oid, Adt, DateID, Id,
Type, Name, ShortName, Deleted )" & _
"SELECT Cparty_Audit.Oid, Cparty_Audit.Adt, Left(Cparty_Audit!Adt,2) AS
DateID, Cparty_Audit.Id, Cparty_Audit.Type, Cparty_Audit.Name,
Cparty_Audit.ShortName, Cparty_Audit.Deleted " & _
"FROM Cparty_Audit" & _
"WHERE (((Cparty_Audit.Adt)>Date()-1)) "
End Function
Stefan Hoffmann - 06 Dec 2006 12:31 GMT
hi,
> I am trying to add the below SQL Query into VB. It seems to fall down on the
> "Where" definition.
Why do you assume this?
> Can anyone see where I've gone wrong?
Use an error handler and
CurrentDb.Execute SQL, dbFailOnError
to get a concrete error.
> Function AppendCpartyYesterday()
>
[quoted text clipped - 7 lines]
>
> End Function
Type and Name are reserved words. Enclose them in square brackets (e.g.
[Type]).
The WHERE condition looks good.
mfG
--> stefan <--
Douglas J. Steele - 06 Dec 2006 13:12 GMT
You're missing a space between the table name in the FROM clause and the
keyword WHERE.
(And make the other changes Stefan suggested)

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
>I am trying to add the below SQL Query into VB. It seems to fall down on
>the
[quoted text clipped - 13 lines]
>
> End Function