RE: Add ONE variable word to report header



Hi, Klatuu:

I thought your second suggestion looked intriguing and wanted to try it. I
went into my report properties and into the open event. I selected the "code
builder" option and pasted your text. This is what I ended up with after the
paste:

Private Sub Report_Open(Cancel As Integer)
If MgbBox("Is This A Revision", vbQuestion + vbYesNo) = vbYes Then
Me.txtReportTitle.Caption = Me.txtReportTitle.Caption & " Revision"
End If
End Sub

Now the report will not open at all when I double-click on it. I can only go
into the design view. What did I do wrong? Thanks.

Ann

________________________

Klatuu wrote:
There are a whole lot of ways to do this. Some of them depend on what
version of Access you are using. If you are on 2003, then you can use the
OpenArgs argument of the OpenReport method and put the response in the
OpenArgs. Then in the Open event of the report:

If Me.OpenArgs = "Revision" Then
Me.txtReportTitle.Caption = Me.txtReportTitle.Caption & " Revision"
End If

If you have a prior version, the OpenArgs is not available. So, you could
get the response to your question in your form and store it in an invisible
text box. Then in the Open event of the report:

If Forms!MyFormName!MyHiddenControl = "Revision" Then
Me.txtReportTitle.Caption = Me.txtReportTitle.Caption & " Revision"
End If

Or, rather than doing it in the form, you could do it in the Open event of
the Report with a MessageBox:

If MgbBox("Is This A Revision", vbQuestion+vbYesNo) = vbYes Then
Me.txtReportTitle.Caption = Me.txtReportTitle.Caption & " Revision"
End If

I am trying to find the most straightforward way to add a single word to a
report header based on user input. I've been looking through the posts and
[quoted text clipped - 15 lines]

Ann

--
Message posted via http://www.accessmonster.com
.