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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't append recordset

Status
Not open for further replies.

Trudye

Programmer
Sep 4, 2001
932
US
I am learning VB 6.0 and I have to create 2 SQL statements. The first one merely creates a recordset. The second one (because it is coming from a different table) has to be appended to the recordset. The first SQL statement is working fine. I can't figure out how to get the second one to work. Here they are:

sqlName = "SELECT contactID, fname, type, Lname, Mi "
sqlName = sqlName & "FROM contactP ORDER BY"
sqlName = sqlName & " Fname, Lname "

Set rsAllNames = dbcontact.OpenRecordset(sqlName)

sqlName = "INSERT INTO rsAllNames (contactID, fName, type) "
sqlName = sqlName & "Select contactid, CompanyName, type "
sqlName = sqlName & "FROM contactB ORDER BY "
sqlName = sqlName & "fName "


I know I have to create a SET statement that will apply the second set of records to rsAllNames. I tried duplicating the existing SET statement but received and error. I tried closing the recordset after the first SQL statement but again recieved and error. Please tell me what my SET statement should look like, or what my alternatives are.

Thanks much
Trudye
 
More of a VB question, than an SQL one, I'd say.
Try forum222 Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top