N
none
I have a report that is supposed to pull up the title from the VBA
code within the report and form that calls out the report. However,
when I click on the button on the form to generate the report, the
report title is always "lagging" one click behind (for example, the
title for the report for "Title A" has no title, when I click on
report "Title A" again then it takes on "Title A"; if I then chose
report "Title B", it calls out the correct data but retains the "Title
A".)
On the form, I have the following code:
===
Private Sub optnSpeakers_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
'OptList =1
DoCmd.Close acReport, "rList"
DoCmd.OpenReport "rList", acViewPreview, , "[Batch]=0"
End Sub
Private Sub optbSponsors_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
'OptList =2
DoCmd.Close acReport, "rList"
DoCmd.OpenReport "rList", acViewPreview, , "[Batch]=97"
End Sub
Private Sub optnParticipants_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
'OptList =3
DoCmd.Close acReport, "rList"
DoCmd.OpenReport "rList", acViewPreview, , "[Batch]=500 or
[Batch]=99"
End Sub
====
In the rList report, I have the following code:
===
Private Sub Report_Open(Cancel As Integer)
If Forms!rListsSwitchboard.optList = 1 Then
Me.Caption = "Title A"
Me.lblReportName.Caption = "Title A"
ElseIf Forms!rListsSwitchboard.optList = 2 Then
Me.lblReportName.Caption = "Title B"
Me.Caption = "Title B"
ElseIf Forms!rListsSwitchboard.optList = 3 Then
Me.lblReportName.Caption = "Title A"
Me.Caption = "Title B"
End If
End Sub
====
Am I using the wrong action/function? What should I be using instead?
Thank you for your help!
code within the report and form that calls out the report. However,
when I click on the button on the form to generate the report, the
report title is always "lagging" one click behind (for example, the
title for the report for "Title A" has no title, when I click on
report "Title A" again then it takes on "Title A"; if I then chose
report "Title B", it calls out the correct data but retains the "Title
A".)
On the form, I have the following code:
===
Private Sub optnSpeakers_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
'OptList =1
DoCmd.Close acReport, "rList"
DoCmd.OpenReport "rList", acViewPreview, , "[Batch]=0"
End Sub
Private Sub optbSponsors_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
'OptList =2
DoCmd.Close acReport, "rList"
DoCmd.OpenReport "rList", acViewPreview, , "[Batch]=97"
End Sub
Private Sub optnParticipants_MouseDown(Button As Integer, Shift As
Integer, X As Single, Y As Single)
'OptList =3
DoCmd.Close acReport, "rList"
DoCmd.OpenReport "rList", acViewPreview, , "[Batch]=500 or
[Batch]=99"
End Sub
====
In the rList report, I have the following code:
===
Private Sub Report_Open(Cancel As Integer)
If Forms!rListsSwitchboard.optList = 1 Then
Me.Caption = "Title A"
Me.lblReportName.Caption = "Title A"
ElseIf Forms!rListsSwitchboard.optList = 2 Then
Me.lblReportName.Caption = "Title B"
Me.Caption = "Title B"
ElseIf Forms!rListsSwitchboard.optList = 3 Then
Me.lblReportName.Caption = "Title A"
Me.Caption = "Title B"
End If
End Sub
====
Am I using the wrong action/function? What should I be using instead?
Thank you for your help!