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

Getting info from a form to report 1

Status
Not open for further replies.

BLutgen

Technical User
May 25, 2001
47
US
I have a database set up with switchboards and I need to have the user enter quote information on a form and then print that information on a report using a command buttom from the form. The information on the form does data-entry into a main table to store the information. I need only the current quote printed. Currently I have it set up with the report being based off of a query that asks specifically for the quote number you just entered. The command button on the form prints the report. However, you have to re-enter that Quote# again so it knows which record to print. Is there some way to avoid this and print a report with the current form information on it, from the form. Thanks.

Brad
 
In the query's criteria cell for the quote id specify the form and field that contains the quote id.

Something like:

Forms!frmQuoteForm.QuoteID

The query will then use the value from the form to supply the report with it's values.

Note: the new, current record must have been saved before you kick off the report.
Larry De Laruelle
larry1de@yahoo.com

 
Thanks for the help but I can't get it working. I go into the Query, go into criteria, take out[Enter Quote #], and then type in what you gave me. I must not be getting the expression right because either it doesn't wotk or I get an error message. The name of the Query is "All by Quote#" The name of the Form is "Panel Quote" The actually field name is
# said:
and is an autonumber field. All of the information is being drawn from one table. What should my expression in the criteria box be? Do I bracket it off or anything? Thanks again for the help.

Brad
 
Brad:

In the criteria cell put:

Forms![Panel Quote].
# said:
The brackets are required becuase you have spaces in the form and field name. I think this should work for you. Remember that the record must have been saved for this to work.

Tip: It's usually a good idea not to use spaces in any naming and to use a prefix to identify the type of object. Tables use tbl, forms use frm (frmPanelQuote), queries use qry or qbe (qbeAllByQuote). It's also a good idea to not use special characters such as the pound sign, exclamation, etc since they have defined uses in Access. The pound sign, for instance, is used as a delimiter on dates.
Larry De Laruelle
larry1de@yahoo.com
 
Thanks for the help. It works great. I just put a litle reminder next to the print button that the record must be save first. It should work well. Thanks again for the help.
 
Brad:

Glad it worked for you.

Another way to prevent the report from being run before the record is saved is to set the Enabled property of the command button to False on an Add Record click event and then set it to True in the Save Record click event.

This way the user cannot 'accidently' try to run the report until the record has been saved.

Larry De Laruelle
larry1de@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top