Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order of Record in Form Keeps Changing/ Why?

Status
Not open for further replies.

0011268899

IS-IT--Management
Nov 4, 2003
8
0
0
US
I have a form in which a user enters records. When needed the user can click on a hyperlink (on the same form) that leads them to a Word document to do a mail merge using the info from the Access DB. When I do a mail merge, I want to do a specific record and not all the records in the DB. So I type in the number of the record I would like to mail merge (based upon the number at the bottom of the screen in Access). What should happen is that person's record should be the info that pulls up on the mail merge letter, but instead it's another record. When I go back into the Access form, the order of the record has changed. Why does this happen? This only happens when I am adding a new record. So instead of the last record entered is the last record in the entire form, it can change and another record that was entered previously is now the last record.
 
Hi,

If I understand, what you really want is to be able to click on the "Print" button on the form and have the Word document open with only the info from the specific record that was in the form at the time you clicked, rather than all records in the Table.

If so, then what you want to do is to create a query that returns just the current record from the form, and then use that query (rather than the entire Table) as the data source in the mail merge.

To create the query, bring the entire Table into the query with all fields showing...that gives you all the fields for all the records in the Table. Then, just bring in the field that is your unique record identifier. For that field, specify the criteria as:

=[Forms]![your form's name]![your unique record id]

(You can click off the Display or Show box (whatever it is) because you've already included it when you brought in all fields from the Table.)

This will narrow down the records to one, since it returns just the record currently populating the form (or the first record if the form isn't open).

Then, you can go and create (or update) your mail merge using the query you just created as the data source, rather than the Table itself.

When you create the button on the form, select the Open Application function and follow the prompts. When you specify what to open, use

Winword.exe c:\...\DocumentName.doc

Best to make sure that there are no spaces in the name of the DocumentName or the path leading to it.

Hope this helps. Let me know if you have any questions.

Blaine
 
Oh. I should mention that I know how to do this only because I recently asked about the same question. I was helped by the following:

FAQ181-271


Good luck,
Blaine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top