hello
I have a function that I use to set a Report's RecordSource. If I run the function TEST_Class(3) shown below, I want to...
a) make a copy of the the Template Report "rClass______BLANK",
b) Rename the copy as "rClass______V_3"
c) Set the RecordSource of the new Report as Table "tClass______V_3"
d) Save the changes to the Report
*** Everything works perfectly until I get to step d). I can't get the changes (RecordSource) to SAVE. The Report shows that the RecordSource is working as it should, but when I try to open it later, it shows no RecordSource.
In the OPEN event of Report "rClass______BLANK", I have code...
Thenk you for any assistance.
I have a function that I use to set a Report's RecordSource. If I run the function TEST_Class(3) shown below, I want to...
a) make a copy of the the Template Report "rClass______BLANK",
b) Rename the copy as "rClass______V_3"
c) Set the RecordSource of the new Report as Table "tClass______V_3"
d) Save the changes to the Report
*** Everything works perfectly until I get to step d). I can't get the changes (RecordSource) to SAVE. The Report shows that the RecordSource is working as it should, but when I try to open it later, it shows no RecordSource.
Code:
Function TEST_Class(V As Integer)
Dim var_Arg As Variant
Dim strRptTemplateName As String, strRptNewName As String
var_Arg = "tClass______V_" & CStr(V) & ""
strRptTemplateName = "rClass______BLANK": strRptNewName = "rClass______V_" & CStr(V) & ""
'copy Template Report, and Rename
DoCmd.TransferDatabase acExport, "Microsoft Access", CurrentDb.Name, acReport, strRptTemplateName, strRptNewName, StructureOnly:=True
'open Report using var_Arg as the RecordSource in the Open event
DoCmd.OpenReport strRptNewName, acViewPreview, , , , var_Arg
'save the report
DoCmd.Close acReport, strRptNewName, acSaveYes
End Function
In the OPEN event of Report "rClass______BLANK", I have code...
Code:
Private Sub Report_Open(Cancel As Integer)
Dim strRecordSource As String
If Not IsNull(Me.OpenArgs) Then
strRecordSource = Me.OpenArgs
Me.RecordSource = strRecordSource
End If
End Sub
Thenk you for any assistance.