Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set access subreport name dynamically

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top