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

Multi-Stage Command Button - Query Criteria -> Record ->Pdf -> Email 1

Status
Not open for further replies.

Donamese

Technical User
Jan 16, 2003
12
US
I have a database that pulls data from Query1 to populate the Lead report. What I am trying to do is create a form where I can enter criteria for the query (agent, gender, age range, and terminated or not). Once the query has the new criteria I need it to populate the report. Once created I want the report sent via email in a pdf format.

Can this be done with one button on a form, and if so how? I am pretty weak on the coding with VB, so any suggestions would be greatly appreciated.

Agent numbers are exact matches as are the gender. Age will be a range like 60-75. Terminations are determined by a field having a character, if the field is null then then it is still in force.
 
OK, here we go

You cannot send a report from Access in a .pdf format (at least I have never been able to figure it out). However, here are instructions for sending the report in a different format.

1) Create a form that will have fields for all the criteria your query will be looking for. Usually combo boxes work best to restrict options;

2) Set the criteria in the query to look for values from the fields on that form. i.e. the criteria in the query for gender would be Forms!frmQueryCriteria!GenderFieldName; There are several ways to handle the age range. The quick one that comes to mind is a combo box on the form with age ranges (65-70) Your query could then use the Right and Left functions to extract the numbers needed “Between Left(FieldName, 2) AND Right(FieldName, 2)”

3) The report that you will be sending will be based on your query.

4) Put a button on your query criteria form, use the DoCmd.SendObject (check the help in the VBA window for the syntax, or post back if you need help).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top