Discussion Locked

MS Access 2000: Pass-through query

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm using a saved Access 2000 pass-through query to return rows from an Oracle database.
=> DoCmd.OpenQuery ("qryPassthruTest") <==
The query returns a datasheet view. I'd like to save the results as an Access table using VBA code.

Can anyonehelp me out? Thanks in advance.

3 replies

by bob sellman

Try this:

Dim strSQL as String
strSQL = "SELECT * INTO NewTable From qryPassthruTest;"
docmd.runSQL strSQL

This should create a new table from your query. You could even just select specific columns by specifying them instead of the asterisk (*).

Obviously it would be best if you would check to be sure it is not a duplicate table name and/or you might want to let the user enter the new table name (or create unique names when you create the table).

by baron34

Your answer made a light bulb go off in my head... thanks for the jolt. I was able to modify your answer to solve my problem. Thanks!

This discussion is closed to new replies.