Detail Group Visibility State

J

Jason Rhymes

I posted this in the forms NG but I should of posted it here.
I'm trying to control a group visibility state in a report through a form
pick box.
This is what I have but it doesn't work.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If [Forms]![JobList]![Show_Detail] = 0 Then
Me.Detail.Visible = True
Else
Me.Detail.Visible = False

End If
End Sub
 
F

fredg

I posted this in the forms NG but I should of posted it here.
I'm trying to control a group visibility state in a report through a form
pick box.
This is what I have but it doesn't work.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If [Forms]![JobList]![Show_Detail] = 0 Then
Me.Detail.Visible = True
Else
Me.Detail.Visible = False

End If
End Sub

Just a helpful tip to help you get good responses when asking
questions in newsgroups.
Words like 'it doesn't work' gives any potential reader who might
want to help you absolutely no useful information.
What didn't happen?
What did happen?
What did you expect to happen?
What is the exact code you wrote (copied directly from your database
and pasted here so we can see if you didn't simply mis-write the
code)?
Answers to those questions would be helpful to us .... to help you!

1) The form must be open when the report is run.
2) What is a form 'pickbox'?
3) Assuming the 'pickbox' (whatever kind of control that is) returns a
number value of 0, try ..... (Shortening your code:)

Me.Section(0).Visible = [Forms]![JobList]![Show_Detail] = 0

Section(0) is the Report detail section.

4) You can also use (in the Detail Format event)

Cancel = [Forms]![JobList]![Show_Detail] <> 0
 
J

Jason Rhymes

Thanks Fred.
Sorry, Pick Box = Check Box.

In any case, I had the form closing through a macro and that was causing it
to fail.
So that brings up another problem. How do you handle the form being in front
of the report (Access 2007)?
Is there a draw order or something that'll push the form to the back?
I can't access the report with the form still open.
 
F

fredg

Thanks Fred.
Sorry, Pick Box = Check Box.

In any case, I had the form closing through a macro and that was causing it
to fail.
So that brings up another problem. How do you handle the form being in front
of the report (Access 2007)?
Is there a draw order or something that'll push the form to the back?
I can't access the report with the form still open.

Your not giving enough information.
How are you opening the report?
How is this form being opened?
From the report?
Or is the report being opened from the form?
Is there code in the report's Open event to open the form?
If so, copy and paste it in a new message.
Is there code on the form to close the form or make it not visible?
If so, copy and paste that code.

The normal method that I use is to open the Report. Code in the
report's open event opens the form in acDialog
DoCmd.OpenForm "FormName", , , , , acDialog
(so report processing pauses).
A command button on the form makes the form not visible.
When the command button is clicked processing of the report then
continues.
When the report is closed, I have code in the Report Close event that
also closes the form.
Note: The above method works in all Access versions up thru Access
2003.
I have no idea if 2007 works the same way, but you can try it.
 
J

Jason Rhymes

Thanks Fred.
Been a while since I did any programming in Access.
I'll try the method you suggest and will post back if it doesn't work but it
looks like that'll work for me.
Thanks again.

Jason
 

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