trying to dynamically set a subreport name to access the reports properties
Option Compare Database
Option Explicit
Public rs5 As Recordset
Public dbs3 As Database
Public sql7 As String
Public aMod As String
Public mymod As SubReport
Private Sub Report_Open(Cancel As Integer)
'get the modules list from table ControlFileWork and show the relevant modules
Dim i As Integer 'counter
Const thisMod = "rptMod"
sql7 = "select * from ControlFileWork where clientno = 1185" & LoadData.Client
Set dbs3 = CurrentDb
Set rs5 = dbs3.OpenRecordset(sql7)
For i = 1 To 13 'current active relevant modules
If Not IsNull(rs5(i + 5)) Then 'if there is a module, show it
aMod = rs5(1 + 5) 'assign the specific subreport module to a variable
Set mymod = thisMod & i & aMod 'locate the specific subreport
mymod.Report.Visible = True 'show the subreport
End If
Next i
can't seem to get the thing to work Bastien
There are many ways to skin this cat,
but it still tastes like chicken
Option Compare Database
Option Explicit
Public rs5 As Recordset
Public dbs3 As Database
Public sql7 As String
Public aMod As String
Public mymod As SubReport
Private Sub Report_Open(Cancel As Integer)
'get the modules list from table ControlFileWork and show the relevant modules
Dim i As Integer 'counter
Const thisMod = "rptMod"
sql7 = "select * from ControlFileWork where clientno = 1185" & LoadData.Client
Set dbs3 = CurrentDb
Set rs5 = dbs3.OpenRecordset(sql7)
For i = 1 To 13 'current active relevant modules
If Not IsNull(rs5(i + 5)) Then 'if there is a module, show it
aMod = rs5(1 + 5) 'assign the specific subreport module to a variable
Set mymod = thisMod & i & aMod 'locate the specific subreport
mymod.Report.Visible = True 'show the subreport
End If
Next i
can't seem to get the thing to work Bastien
There are many ways to skin this cat,
but it still tastes like chicken