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

Printing current records in a form 1

Status
Not open for further replies.

Aiii

Technical User
May 7, 2003
18
AU
Hey, i am using Access 97 and am creating an inventory database which has many different types of fields.

Now i have created a form for the easy entry of data but i have no idea how i would print the data only for the record i am currently viewing on the form.

If i create a report, it has the layout and info i want buthas the info for every record, which can make it difficult to sort through what i want to print.

I saw another thread on these forums, similar to what i'm asking but the code given was too confusing, and after many failed attempts i have decided to ask you guys.

Any help will be greatly appreciated.
 
Hi,

Create a report using a query of the table underlying the form.

Open the query in the design view
Type in the criteria of the particular field like below.

Forms![YourFormName]![YourFieldName]

Note: YourFormName is Name of the Form
YourFieldName is Name of the Field

Create a Command Button on the Form to open the report.

That is all.

Try it and respond.

ZmrAbdulla
 
Ok,

Sorry for the mega delay but i have been so busy lately that i haven't had time to try this.

Now, i made a query with all the fields and added Forms![YourFormName]![YourFieldName] to the criteria of every field with the form name staying the same for all fields but with the field name changing depending on the field im adding it to.

Then i made a report based on the query and once it had finished and i went to open the report it asked me to add some parameters, which i guess it should have done so it can have info to input into the report.

Well the problem is, that when i added a command button on the form to preview the report, the report comes up but there is no data, or it doesnt show any record information, its just blank.

Any idea why?
 
Hi,
You remove all the parameters typed into the criteria of the query except one field. This field must be main. (Like in a Record set of a Telephone Directory, Person's name may be main). Then it won't ask you any more parameters.

ZmrAbdulla
 
So i should put the following code in criteria for only the primary field?

Forms![YourFormName]![YourFieldName]

So for instance it should be something like this

Forms![F_Server_Data]![Serial_No]
 
Disregard my previous message.

I only added the criteria to the primary key field and it works great.

Thanks so much.

Your definately getting a star for this one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top