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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report information into a template?

Status
Not open for further replies.

Ryan32

Technical User
Oct 12, 2004
4
US
First off, i havn't used Access in roughly 4 years, so please forgive me if i sound a little lost.

I am wondering if it is possible to pull certain fields in my database, and have them either placed into a word template as variables (ie: certain fields are inserted into the correct space in the template) or if i could do a report within Access that way, designing the same template in Access and having variables insert specific data dependent on what the user wishes.

I am a Marine, and i'm trying to automate the task of creating Leave papers. So basically i'm trying to create a user interface where you choose which Marine is going on leave, what dates, and it'll automatically place his information into a leave template. (His name, social, rank etc which is in the database)

Is this possible to do with Access? I searched the forum and couldn't find anything on this specifically, so i appologize if it has been covered already.

I am running Access 2003 also. Thanks for any help you might be able to offer! :)
 
if your template is a Word document, then look at Mail Merge and create a query in ACCESS that you can use as the datasource for the Mail Merge.

PaulF
 
I found a way to do it in an Access Report...
However, now i have 1 small problem.

All of the information is in the Report, and they are filled out correctly, but when i create a button on the form to print the Report, instead of printing 1 report (the one i am entering info on) it reports all 160 of them....

What can i do to have it print a single report instead of the entire thing?
 
I'm sorry, i meant to say 1 record...

I am trying to print individual records, instead of the entire 160 page report... Is there a way i can print the record that i have pulled by itself, instead of printing the entire report? Again, i'm trying to do this via a command button in the form.
 
open the report with a "Where Condition", check the help files to show you how

PaulF
 
All the help file tells me is that i need to use the following:

[fieldname] = Forms![formname]![controlname on form]

It doesn't tell me where i place that? I'm not real great with Access, so i cannot find where to place that.

I opened the Form in VB view, and I went down to the actual button, where i have:

Dim stDocName As String
Dim stWhere As String

stDocName = "Admin Lv Papers"
stWhere = "[Ssn]=" & Me!Ssn
DoCmd.OpenReport stDocName, acPreview, stWhere

Do i enter it somewhere in there? I looked at the VB source for the Report page, and there was nothing in it....

Again, sorry for being such a pain, but i am fairly lost.
 
you stated that you used a command button to open the report, but that it was returing all 160 records instead of just the one you were viewing. The code is called by the On Click Event of the command button... however, the code you show is incorrect, it needs one more comma in it

DoCmd.OpenReport stDocName, acPreview, stWhere
should be
DoCmd.OpenReport stDocName, acPreview, ,stWhere

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top