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!

Setting Parameter on a Report

Status
Not open for further replies.
Nov 22, 2007
38
GB
Hi

I have a report that i have inherited from an old database that i have upgraded from 97. The report somehow used to print out the last audit that was completed and print the details but since upgrading the database this no longer works.

I would like the report to prompt for the lab reference before printing the report to ensure that the correct information is printed but i can't seem to get it to work.

The report is based on a table and then code behind to pull through the rest of the information.

There is quite a bit of code relating to the report so i think i may be putting it in the wrong please?

Code:
Private Sub print_Click()
Dim print_response As Integer
Dim cond As String, repname As String

cond = DLookup("[macroname]", "Report Names", "[reptitle]=forms![report screen].[reptitle]")
repname = DLookup("[repname]", "Report Names", "[reptitle]=forms![report screen].[reptitle]")

    On Error Resume Next

DoCmd.OpenReport repname, A_NORMAL, , cond


DoCmd.SetWarnings False
On Error GoTo 0
If [reptitle] = "Report Analyses" Then
    print_response = MsgBox("Do you want to mark these Analyses as Printed ?, Y/N", 292, "Analysis Printout")
    If print_response = 6 Then DoCmd.OpenQuery "update print flag"
End If

If [reptitle] = "sample logging audit trail" Then
    print_response = MsgBox("Do you want to Update the logging audit file ?, Y/N", 292, "Analysis Printout")
    If print_response = 6 Then DoCmd.OpenQuery "update audit print flag"
End If

DoCmd.SetWarnings True
End Sub

Any help on shedding some light on this greatly received.

Ralph
 
Hi ralphralph07 (MIS),
Since this is the module section of ms access and you have a report-problem, I suggest you post it in the Report section...

Pampers [afro]
Keeping it simple can be complicated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top