Creating & Populating Temporary Table from String

Cosmonaut_99

Registered User.
Local time
Today, 14:43
Joined
Oct 24, 2012
Messages
15
I'm trying to create a temp table, which is populated by a string, (taken from a recordset).
My problem is incorporating the String into the SQL statment, and making it work,

What I'm trying to do is to create a temp table, and populate it with the first record of the recordset, (which is an e-mail address).

(The recordset and the strings work fine). It's the SQL statement which doesn't work.

Any help would be great.
Here's the code I have :


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set DBS = CurrentDb
Set RST = DBS.OpenRecordset("SELECT Contact FROM Contacts_to_be_Mailed")

Dim My_Count As Long
Dim ContactString As String

RST.MoveFirst
ContactString = RST(0)


Dim strTable As String
strTable = "TempContact"

DoCmd.RunSQL "INSERT * INTO " & strTable & " FROM ContactString "
 
Without trying to suggest corrections to your code - may I suggest you step through the code and use the locals window to see what the actual sql string looks like that you are trying to build - ?
 

Users who are viewing this thread

Back
Top Bottom