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!

Printing one of two reports

Status
Not open for further replies.

djeverett01

Programmer
Aug 24, 2001
16
US
This is what I want to do, I want to click a button and when I click the button one of two reports will print. I have two different reports one that lists all the jobs to be posted and one that when there are no postings it simply prints no postings. I need to know if I can make it where when you click print it will look at a query and see if the no postings box is checked and if so it will print the no postings report otherwise it will print the other report. Is this possible?
 
Hi!

Since I don't know the setup of your tables I can only give you general information. On the button click try this:

Dim rst As DAO.Recordset
Dim sql As String

sql = "YourQuery"
Set rst = CurrentDb.OpenRecordset(sql, dbOpenDynaset)

If rst!NumberOfPostings = 0 Then
DoCmd.OpenReport "NoPostings"
Else
DoCmd.OpenReport "JobPostings"
End If

Set rst = Nothing

This assumes that you have a field which will indicate if there are any postings. If the situation is different, let me know and we can take it from there.

hth Jeff Bridgham
bridgham@purdue.edu
 
This is similar to something I want to do.

My client has two reports that are identical, save for the two sort order fields: one report prints the data by supervisors within managers, the other prints managers within supervisors. The above question appears to address the question how does the user select which report. In my case, once the report preference is indicated, how can I use the same report form and swap the grouping levels. I thought I could do this, but I've failed miserably in getting it to work neatly.

Thanks, John Harkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top