Can't Reference Variable in Report

ggj13557

Registered User.
Local time
Today, 01:28
Joined
May 10, 2004
Messages
11
I am trying to reference a variable that was created within a form and use it as the title of a report. I have tried to make the variable public but still don't know enough to be able to make the report read the variable.

I have attached a small database that provides an example of what I am trying to do. In the example database you open form1, make your selection (either color or number) and it opens report1 displaying only the information that you requested. However, the submit button also contains the variable "stRptTitle" which I want to appear as the Title for the report. This title needs to change based on the information selected in form1. Here is the code as it currently stands.

___________________________________________________
Dim stLinkCriteria As String
Dim stRptTitle As String

If Frame0.Value = 1 Then
stLinkCriteria = "(((Table1.Type)='color'))"
stRptTitle = "This Is The Color Report"
End If

If Frame0.Value = 2 Then
stLinkCriteria = "(((Table1.Type)='number'))"
stRptTitle = "This Is The Number Report"
End If

DoCmd.OpenReport "Report1", acViewPreview, , stLinkCriteria

DoCmd.Close acForm, "Form1"
____________________________________________________

Any help with this problem would be greatly appreciated.
 

Attachments

Report title

Hopefully the attached file helps. At least, I think it's attached. Put a text box on your form and set it to equal the information behind the submit button. Then refer to that field in your report.
 
Rickster57,

I don't see an attached file.
 

Users who are viewing this thread

Back
Top Bottom