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
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