Basic Append Query

p00le

New member
Local time
Today, 09:49
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
 
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?
 
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 & "');")
 
Thanks Pat,

Adding the quotes worked like a charm!
 

Users who are viewing this thread

Back
Top Bottom