Okay I'm desperate AGAIN

G

Guest

I have two reports set up with similar information, depending on the "Project
Number" a field has been created for both reports that indicate report 1 or
report 2. Now, I'm using a form as a database menu. How can I either:
1. Create a button that will look at the REPORT field and if the # is 1
generate the standard report or the modified report if the # is 2?
or
2. Have the button look at the REPORT field and generate an error message
telling the user to select the other button if I create a button for each
report?
 
L

Larry Linson

Lori said:
I have two reports set up with similar information, depending on the
"Project
Number" a field has been created for both reports that indicate report 1
or
report 2. Now, I'm using a form as a database menu. How can I either:
1. Create a button that will look at the REPORT field and if the # is 1
generate the standard report or the modified report if the # is 2?
or
2. Have the button look at the REPORT field and generate an error message
telling the user to select the other button if I create a button for each
report?

Are you conversant in VBA? It should not take much. So little that, with a
little information, you could probably get it here.

What are the names of each Report? Where is this "REPORT Field" -- in a
Table (if so, what's the name of the Table; how do you identify the Record
to use as source for the Report Field?)? Do you want to put this Command
Button on the same Form you are using as your Database menu (we usually call
those "Switchboards" or "Switchboard Forms").

Do the Reports have identical data, only differing in which Project is the
source? If so, then perhaps a single Report may do the job, and be simpler
in the long run. If the Reports are unique, and have some different data,
then it is at least less likely that a single Report will be the appropriate
solution.

Larry Linson
Microsoft Access MVP
 
G

Guest

I'm using a form not a switchboard. I have way too many items and I would
have to have dozens of submenus to do the job. I have a form which utilizes
the buttons to "on click" open a form or report as needed.

The two reports are almost identical, they pull their data from the same
place, the only difference is one report has two additional fields that are
not included in the first one.

I can manage with VBA but there's a lot left for me to learn. Any help
would be appreciated.
 
G

Guest

Sorry forgot some info...the first report is called Projected Final Cost, the
Second is Projected Final Cost-Modified. There is one field called PFC
Option, 1 indicates the first report, 2 indicates the second.
 
G

GLepage

Sorry forgot some info...the first report is called Projected Final Cost, the
Second is Projected Final Cost-Modified. There is one field called PFC
Option, 1 indicates the first report, 2 indicates the second.

Add a command button to the form for the purpose of printing the
reports.

In the "Click" event of the command button add the following code:

Private Sub CommandPrint_Click()
Dim strDocName As String

If Me.PFC_Option = 1 then
strDocName = "Project Final Cost"
Else
strDocName = "Project Final Cost-Modified"
End If

DoCmd.OpenReport stDocName, acPreview

End Sub

The field name and report names must match exactly what you have named
them in the database.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top