By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,560 Members | 1,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,560 IT Pros & Developers. It's quick & easy.

Simple database export

P: 15
Hi all,

I hope someone can help me.

Running access 03 on win xp.

I have a single table database which contains name, address and last contact date as its fields. The number of records is around 500.

Every now and again I need to run a query that sorts records that where last contacted between 2 dates. When I get this info I manually copy and paste it to excel then use word to make it into a mail merge document for making address labels. I want to design a vb script that would action this automatically. i.e. froma control request 2 dates, upon entry and confirmation the labels are ready to print. To be honest even to get as far as the excel export would be good.

I realise that this is quite a big ask, but even if someone could point me to an article online that could help me out it would be much appreciated.
Dec 18 '06 #1
Share this Question
Share on Google+
8 Replies


NeoPa
Expert Mod 15k+
P: 31,602
You can start off with a query (I used 'YourTable' as your table name) :
Expand|Select|Wrap|Line Numbers
  1. SELECT [name],[address],[last contact date]
  2. FROM YourTable
  3. WHERE [last contact date] Between [Enter Start of Date Range] And [Enter End of Date Range]
which will return the data required. It will prompt the operator to enter the two dates required.
Dec 20 '06 #2

P: 15
You can start off with a query (I used 'YourTable' as your table name) :
Expand|Select|Wrap|Line Numbers
  1. SELECT [name],[address],[last contact date]
  2. FROM YourTable
  3. WHERE [last contact date] Between [Enter Start of Date Range] And [Enter End of Date Range]
which will return the data required. It will prompt the operator to enter the two dates required.
Thank you so much, that was a lot easier than I thought.

Just one more question, can the data be directly mailmerged to a word doc from a query?

Thanks
Dec 28 '06 #3

NeoPa
Expert Mod 15k+
P: 31,602
I expect it can be done in code but I can't help you there I'm afraid.
Dec 28 '06 #4

P: 15
No probs, another way I have considered trying is building a macro to export the saved results from the query. Can I modify the above code to save the results in a new table?
Dec 28 '06 #5

NeoPa
Expert Mod 15k+
P: 31,602
Try :
Expand|Select|Wrap|Line Numbers
  1. SELECT [name],[address],[last contact date]
  2. INTO [NewTable]
  3. FROM YourTable
  4. WHERE [last contact date] Between [Enter Start of Date Range] And [Enter End of Date Range]
Dec 30 '06 #6

P: 15
Try :
Expand|Select|Wrap|Line Numbers
  1. SELECT [name],[address],[last contact date]
  2. INTO [NewTable]
  3. FROM YourTable
  4. WHERE [last contact date] Between [Enter Start of Date Range] And [Enter End of Date Range]
Thanks, that has solved the problem! Can a make table query be combined into a report? I have got it down to a 2 stage process as in, click 1 Create table, click 2 show report.

Its not a big issue, just curious can it be done
Jan 11 '07 #7

NeoPa
Expert Mod 15k+
P: 31,602
I don't believe you can create a table as well as power a report from the one query.
You could, of course, just use a SELECT query for the report but that would miss out the create table step.
Jan 11 '07 #8

P: 15
I don't believe you can create a table as well as power a report from the one query.
You could, of course, just use a SELECT query for the report but that would miss out the create table step.
No worries, thank you for the help
Jan 11 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.