View Full Version : Populate table with recordset data using vba


lamx0063
01-28-2008, 06:07 PM
Hi,

I need help populating a table with recordset data using vba. The number of columns in the table depends on the recordset data. Meaning, if the recordset has 5 columns, the table would populate 5 columns. The data that I am getting isn't always the same number of columns.

Thanks.

jdraw
01-28-2008, 06:40 PM
Hi,

I need help populating a table with recordset data using vba. The number of columns in the table depends on the recordset data. Meaning, if the recordset has 5 columns, the table would populate 5 columns. The data that I am getting isn't always the same number of columns.

Thanks.

Please provide the structure of your Table, and examples of your "recordset(s)".
Perhaps a brief description of what you are trying to do would help also.

lamx0063
01-28-2008, 07:04 PM
For example:
strSQL = "SELECT * FROM tableA;"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset)

create tabletemp
populate tabletemp with rst data

FYI: tableA is from another database. I also have other tables which has different columns and could be in place of tableA.

ajetrumpet
01-29-2008, 09:56 AM
For example:
strSQL = "SELECT * FROM tableA;"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset)

create tabletemp
populate tabletemp with rst dataThe first thing that comes to mind here is an import of the table and structure instead of messing around with code.

Why can't you do that?