Avatar of bill201
 asked on

how can i in access vba copy a query structure in the same database


how can i in vba access copy a structure from query to another table in the same database

for example i want to make a table the the name will be table1 and it's will be emtry but the structure will be like the  in the query "Query1"

Microsoft AccessDatabases

Avatar of undefined
Last Comment
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

8/22/2022 - Mon
Kent Dyer

I think the Copy and/or save as Wizard from Access will prompt whether you will copy the data and/or structure (schema) from one Access db to another.


DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

Put this code in a regular VBA module

Public Function mMakeTable()

    With CurrentDb
        .Execute "SELECT Query1.* INTO Table1 FROM Query1"  'Make the table
        .Execute "DELETE Table1.* FROM Table1" 'delete records
    End With

End Function

Then you can call mMakeTable() from the vba Immediate Window if you like.

All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck