Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recordsets and SQL

Status
Not open for further replies.

rpbenito

Programmer
Jun 13, 2001
63
US
I have done a sql query on a table and have the needed info in a recordset... My problem is now that i have the recordset i want to run an insert sql to put the info in a table....here is what i have

Dim pref As String
pref = rec(1).Value
DoCmd.RunSQL ("insert into ContactInfo(prefix) values( " & pref & " )")


...the error is in the sql statement...i know it is something small...can anyone correct my line of code? thanks a lot
 
In the SQL statement, pref needs to be surrounded by single quotes. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top