test for report open? in a2k

G

Guest

just to see if this can be done w/ a2k ---- i have a form which user uses to
enter startdate and stopdate which will limit the breadth of the report
generated by the 'Print' and 'Preview' report cmdbuttons on it. there is a
cmd button on the same form to 'Close' the report (when it's being
previewed). 64$ question.....is there a way to disable the 'Close' button
when the report's already closed?

thanks in advance for any bandwidth!

ted
 
J

John Spencer

Open the form with the button disabled
Enable the button when you click Print Preview
Disable the button on the form using the Report's close event

Of course, you'll need to trap for errors - in the report's close event
-- Is the form Open
-- Does the close button have the focus
 
F

fredg

just to see if this can be done w/ a2k ---- i have a form which user uses to
enter startdate and stopdate which will limit the breadth of the report
generated by the 'Print' and 'Preview' report cmdbuttons on it. there is a
cmd button on the same form to 'Close' the report (when it's being
previewed). 64$ question.....is there a way to disable the 'Close' button
when the report's already closed?

thanks in advance for any bandwidth!

ted


CloseButton.Enabled = CurrentProject.AllReports("ReportName").IsLoaded

Where you place the code will depend upon what and how you are doing
this. If you place the code in the CloseButton click event, you must
first set focus to any other control, then you can un-enable the
command button:

[SomeOtherControl].SetFocus
CloseButton.Enabled = etc...

You can make it enabled again in the Preview button code (or
elsewhere) :

Me!CloseButton.Enabled = true
 
G

Guest

john,

in my onopen of the form's event what would i actually say? the name of my
"Close" cmdbutton is 'CloseButton'. i tried "me.CloseButton" thinking i would
get the intellilsense to lead me to the 'enabled' property but no cigar?
 
G

Guest

hi fredg,

take a look at my CloseButton code


Private Sub CloseForm_Click()

On Error GoTo Err_CloseForm_Click
Dim stDocName As String

stDocName = "Patients on Follow-Up"

Me.TrackSite.SetFocus
Me.CloseButton.Enabled = CurrentProject.AllReports(stDocName).IsLoaded

DoCmd.Close acReport, stDocName, acSaveNo

Me.CloseButton.Enabled = False
Exit_CloseForm_Click:
Exit Sub

Err_CloseForm_Click:
MsgBox Err.description
Resume Exit_CloseForm_Click

End Sub

it won't compile and i'm getting an 'Invalid Qualifier' message at the point
where i define the Me.CloseButton. what's it mean?

fredg said:
just to see if this can be done w/ a2k ---- i have a form which user uses to
enter startdate and stopdate which will limit the breadth of the report
generated by the 'Print' and 'Preview' report cmdbuttons on it. there is a
cmd button on the same form to 'Close' the report (when it's being
previewed). 64$ question.....is there a way to disable the 'Close' button
when the report's already closed?

thanks in advance for any bandwidth!

ted


CloseButton.Enabled = CurrentProject.AllReports("ReportName").IsLoaded

Where you place the code will depend upon what and how you are doing
this. If you place the code in the CloseButton click event, you must
first set focus to any other control, then you can un-enable the
command button:

[SomeOtherControl].SetFocus
CloseButton.Enabled = etc...

You can make it enabled again in the Preview button code (or
elsewhere) :

Me!CloseButton.Enabled = true
 
G

Guest

i just wanted to follow-up on my reply of yesterday. i had a chance to
realize that using your 'CloseButton' verbiage needed adjustment in my vba
code. once out of the way, and with some more tweaking i was able to get this
ramped up.

much thanks fredg.

-ted

fredg said:
just to see if this can be done w/ a2k ---- i have a form which user uses to
enter startdate and stopdate which will limit the breadth of the report
generated by the 'Print' and 'Preview' report cmdbuttons on it. there is a
cmd button on the same form to 'Close' the report (when it's being
previewed). 64$ question.....is there a way to disable the 'Close' button
when the report's already closed?

thanks in advance for any bandwidth!

ted


CloseButton.Enabled = CurrentProject.AllReports("ReportName").IsLoaded

Where you place the code will depend upon what and how you are doing
this. If you place the code in the CloseButton click event, you must
first set focus to any other control, then you can un-enable the
command button:

[SomeOtherControl].SetFocus
CloseButton.Enabled = etc...

You can make it enabled again in the Preview button code (or
elsewhere) :

Me!CloseButton.Enabled = true
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top