G
ggj13557
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 created 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.
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 created 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.