Choosing Destination Report (1 Viewer)

vdanelia

Registered User.
Local time
Today, 06:59
Joined
Jan 29, 2011
Messages
215
Hello, Please Help!

I have a form With A button on It: Here Is The Code

On Error GoTo Err_Preview_Click
Dim stDocName As String
DoCmd.Close
stDocName = "DATA"
DoCmd.OpenReport stDocName, acPreview
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
MsgBox Err.Description
Resume Exit_Preview_Click

As you see being clicked the button a Report "DATA" will be opened.
How to change reports by selecting (If I have some)
I need some kind of selector which will open the report which I'll select

Thank You!
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:59
Joined
Jul 9, 2003
Messages
11,862
The usual method is to have a combo box which contains the names of your reports, the reports that you want the user to be able to select, then in the after update event of the combo box you call the code you have provided with a slight modification:

Change:
stDocName = "DATA"
To:
stDocName = myReportsListCombo.value

Assuming that the combo box is displaying a text field and the contents of the text field is the name of the report you want to open.

I'm sure there are several solutions already available for this, including one which actually extracts all your report names for you and fills the combo box with these names. Although I can't think where you would find this example off the top of my head.
 
Last edited:

vdanelia

Registered User.
Local time
Today, 06:59
Joined
Jan 29, 2011
Messages
215
Thank You Uncle Gizmo Very Much for the Help!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom