Basic Append Query (1 Viewer)

p00le

New member
Local time
Today, 19:50
Joined
May 1, 2001
Messages
8
Hello,

I have coded a basic append query to add a single record to a table. One of the fields I am adding to the table is a hyperlink and it is producing an error "Syntax Error in date in query expression '#http....#'. Here is the query:
DoCmd.RunSQL ("INSERT INTO Docs (DocID, DocName, DocDate, DocSource) VALUES (" & Me!DocID & ", " & Me!DocName & ", " & Me!DocDate & ", " & Me!DocSource & ");")

I'm not sure how to fix this. Any ideas??

Thanks in advance,
Julia
 

rickyc

New member
Local time
Today, 19:50
Joined
Jan 10, 2002
Messages
8
why do you have a date in the hyper linke field?

Did you define the field that you trying to add data to as date?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:50
Joined
Feb 19, 2002
Messages
43,425
Since the hyperlinks are text strings, they need to be surrounded with single or double quotes.

DoCmd.RunSQL ("INSERT INTO Docs (DocID, DocName, DocDate, DocSource) VALUES ('" & Me!DocID & "', '" & Me!DocName & "', '" & Me!DocDate & "', '" & Me!DocSource & "');")
 

p00le

New member
Local time
Today, 19:50
Joined
May 1, 2001
Messages
8
Thanks Pat,

Adding the quotes worked like a charm!
 

Users who are viewing this thread

Top Bottom