Solved Insert Into SQL statement (1 Viewer)

Momma

Member
Local time
Tomorrow, 05:47
Joined
Jan 22, 2022
Messages
114
Hi
I'm getting a Syntax error in the RunSQL statement. It must be something to do with the date because it works fine when I leave it out. I did a compile with no errors.


Code:
DoCmd.RunSQL "INSERT INTO tblDogsChecklist (ContactID, DogID, InfoEmail) " & _
      " VALUES ContactID, DogID, (date())"
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:47
Joined
Oct 29, 2018
Messages
21,476
Is InfoEmail a date field?
 

cheekybuddha

AWF VIP
Local time
Today, 20:47
Joined
Jul 21, 2014
Messages
2,280
The left paren before (date()) should move between VALUES and ContactID
Code:
DoCmd.RunSQL "INSERT INTO tblDogsChecklist (ContactID, DogID, InfoEmail) " & _
      " VALUES (ContactID, DogID, date())"

hth,
d
 

Momma

Member
Local time
Tomorrow, 05:47
Joined
Jan 22, 2022
Messages
114
The left paren before (date()) should move between VALUES and ContactID
Code:
DoCmd.RunSQL "INSERT INTO tblDogsChecklist (ContactID, DogID, InfoEmail) " & _
      " VALUES (ContactID, DogID, date())"

hth,
d
 

Momma

Member
Local time
Tomorrow, 05:47
Joined
Jan 22, 2022
Messages
114
The left paren before (date()) should move between VALUES and ContactID
Code:
DoCmd.RunSQL "INSERT INTO tblDogsChecklist (ContactID, DogID, InfoEmail) " & _
      " VALUES (ContactID, DogID, date())"

hth,
d
That worked, thank you so much. I appreciate your help!
 

Users who are viewing this thread

Top Bottom