Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wishful thinking here.

    The following code works perfectly, so there is not a problem with it:

    Private Sub butAudit01_Click()
    On Error GoTo Err_Click
    DoCmd.OpenReport ReportName:="rpt_GCO - LabelAudit", WhereCondition:="[GCO - Status]=1", View:=acPreview
    DoCmd.RunCommand acCmdZoom100
    Exit Sub
    Err_Click:
    If Err <> 2501 Then
    MsgBox Err.Description, vbExclamation
    End If
    End Sub

    The report in this case, rpt_GCO - LabelAudit , is a generic report used for a large number of reports with varying WhereCondition each time it is run.

    What I would like to do is embed a "Caption" in the above code which would "Customize" each running of the report by having that variable displayed in a text box on the report. This sounds convoluted but I'd get something:

    "Design" Label Audit
    "Student" Label Audit,

    etc.

    I would appreciate any help with this.

    And also, this new layout is fantastic! Congratulations to all who've worked on it
    Cheers,
    Andy

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='AGMCon' date='27-Feb-09 04:38' post='762101']

    You can put a text box (visible or not) on the form that call the report. In the on Click event set the text box to the caption you want to use.
    Private Sub butAudit01_Click()
    On Error GoTo Err_Click
    Me.Textbox = "Design"
    DoCmd.OpenReport ReportName:="rpt_GCO - LabelAudit", WhereCondition:="[GCO - Status]=1", View:=acPreview
    DoCmd.RunCommand acCmdZoom100
    Exit Sub
    Err_Click:
    If Err <> 2501 Then
    MsgBox Err.Description, vbExclamation
    End If
    End Sub

    And in the report add your Caption text box with a control source like :
    =Forms!CallingFormName!Textbox & " Label Audit"
    Francois

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •