Jump to content

MS Access and selecting specific tables

Recommended Posts

I have been working on a script for a while now, my first one, but not my first programming language. I have everything worked out and the script works exactly like it should, but I want to automate the entire process as an upgrade to the script.

Here is the problem:

MS Access has a built in table export function. I am utilizing that to export the data from a table into a text file and copying the text file to a secondary, backup location. Everything works as expected, especially because I found some great posts with help on this forum. The problem is, this automated process works only on the table that was activated last before Access was closed prior to the execution of the script.

What I want to be able to do is select a table to export, both as a safety measure to avoid problems as well as an additional functionality via multi-table exports. So far, I have not been able to find a way to select which table I want to access through any of the Built in Commands in Access. I have an idea, but it is very cumbersom.


Currently, I use the menu commands in Access to select "View -> Database Objects -> Tables" to get to the tables screen in case someone had a different list up. I also did this as a proof of concept, because I might need to run a query some time and this same idea can be used to select them.

The idea I had to select the table/s I wanted would be to select "View -> Details" to create the list, alphabetized. Then, I could use a simple letter to jump to a database table. This would require a single letter to be used for a single table, database naming conventions aside. This would work, but would be very cumbersome, I would much prefer a way to select a specific table without having to open it and check the window name.

If anyone has any feedback at all, I would really appreciate it.

Link to post
Share on other sites

I am not actually doing anything to this database itself. I am using the built in functionality of MS Access to export the data stored on a table. It puts it into a textfile, deliniated by commas.

I played around with some options and was able to set the name of the exported text file to a variable name plus the current date, creating a unique export of a day's transactions. I was a kinda proud of myself for figuring all that out by myself lol.

I am using Send("") commands to simulate keystrokes. In Access 2000, its "File -> Export" and it opens the export dialog box, which I have been able to get to function properly. The problem is, when the *.mdb file is opened, it has a table already selected, whichever table was last selected before it was closed. I need a way to select a specific table from the list of them in the database.

Link to post
Share on other sites


You can look at the sql approach;

UDF from my sig gives examples; and a new function UDF was posted by someone else just yesterday in examples, i believe.

Best, randall

Had to figured out what you meant by UDF lol, but User Defined Function, got it.

I am looking at your AccessCom.au3 and it looks very promising. I will see if I can get the SQL approach to work, if it does, I will be very happy. the "$s_TableName" seems to be what I need if I chance my approach some.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...