Sign in to follow this  
Followers 0
Jevroth

MS Access and selecting specific tables

5 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

thinking way back....

i did a vb app once that used an access database...if i remember correctly i somehow ended up interfacing with access like sql, and all my datamanagment was done with select * from * where * ect... how you managing it?

Edited by evilertoaster

Share this post


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.

Share this post


Link to post
Share on other sites

Hi,

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.

Share this post


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
Sign in to follow this  
Followers 0