Forum Moderators: open
I have a database table of members stored and managed by a custom VB application. This application stores all the data in a *.mdb file which MS Access can open (as you know ;) I want to be able to create a script/query in MS Access that will query this table and produce a CSV file or similar using ; (semi-colons) as a separator with all the email addresses in this table. Also another query that will give me all the members names, addresses, towns and postcodes in an envelope format. Can someone be kind enough to assist me with this?
With thanks in advance
-Gs
SELECT emailaddress
FROM mytable
with any WHERE conditions that you want. This will give you one email per line, not a long list of ';' delimited emails. Not sure what good a single long list of delimited emails would do you unless you have some custom app that needs it that way or you're trying to generate an email TO recipient list... in which case, if you have a lot of data, you will likely want to break it up into multiple emails. I don't know how to covert rows to columns in MS ACCESS in SQL. However, this would be very simple using a little VB app.
As far as your second request for generating a mailing list in 'envelope' format, you don't really even need a script to export from MS Access in .CSV format. And generating mailing labels or printing addresses on envelopes is very easy if you have MS Word. MS Word's Mail Merge utility can take it's data from CSV files, Excel spreadsheets, even databases like MS Access directly. If you have MS Word, search the help for 'Mail Merge'.
If you still want to save your member data to a CSV file the following should get you started. I'm running 2003 MSAccess and the instructions are similar to the following:
1) Launch MS Access
2) Click on 'Tables' in the object list.
3) Double-click on your member table name. This should open the table in grid-view.
4) With the table open, select File / Export.
5) At the 'Export Table 'tMember' To...' dialog pick a location and filename, select 'Text Files (*.txt;*.scv;*.tab;*.asc)' from the Save as type: dropdown list below the File name: text box, then press the Export All button. This will launch the 'Export Text Wizard' dialog box.
6) Select the Delimited radio button at the top and press Next.
7) Select a delimiter at the top of the dialog box and press the Next button.
8) Press finish and Wallah!
If you export as .CSV I think you'll have to read it into Excel to run Microsoft Mail Merge against the data. But you can also export your MS Access data directly to a Microsoft WordMerge (.txt) format which is basically a CSV file with a .txt extension that MS Word can read directly without going through Excel.
Just look up Mail Merge in the MS Word help for everything you need to know about this. It's been a while since I used it but it is VERY simple to get working especially since you are already using an MS database.
Good luck.
[edited by: ZydoSEO at 7:13 pm (utc) on Oct. 1, 2008]