Link to home
Start Free TrialLog in
Avatar of ryanvb83
ryanvb83Flag for United States of America

asked on

Using VBA, how do I create a new table in Access that contains specific data from an existing table?

I am writing a VBA module and I would like to create a table that contains some records from an existing table.  I do NOT want to specifiy the field names because I want to use the module to copy several tables and they are all different.  I am using the following code:
strSql = "CREATE TABLE " & Right(tbl.Name, (Len(tbl.Name) - 3)) & " SELECT * FROM " & tbl.Name & " WHERE cust_id >= " & minvalue & " AND cust_id <= " & maxvalue
        DoCmd.RunSQL strSql

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial