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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide field in report

Status
Not open for further replies.

balistikb

Technical User
Nov 12, 2002
177
US
Hello All, I have a form that a user will select an option from a drop down (option desn't matter). After selection that option, the user then clicks on a command button that views the report. What I am looking to do is add a check box to the form that will give the user a choice whether or not to view the [resolution] field in the report when it is viewed. Any ideas? Here is what I tried to use:
Private Sub cmdOpenIssuesbyIssueNumber_Click()
On Error GoTo Err_cmdOpenIssuesbyIssueNumber_Click

Dim stDocName As String

stDocName = "3_Open Issues - by Issue Number"
If [frmSelectProj]![ResolutionCheck].Value = -1 Then
[3_Open Issues - by Issue Number]![Resolution].Visible = False
End If

DoCmd.OpenReport stDocName, acPreview
DoCmd.Close acForm, "frmSelectProj"

Exit_cmdOpenIssuesbyIssueNumber_Click:
Exit Sub

Err_cmdOpenIssuesbyIssueNumber_Click:
MsgBox Err.Description
Resume Exit_cmdOpenIssuesbyIssueNumber_Click

End Sub
 
Try putting your If statement in the On Format event of your report in the report section where Resolution resides....



A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
Douglas Adams
 
Unless I'm mistaken, you may have a much simpler solution:

If the default Visible property of the field is False, it will never be displayed according to the code snippet.

Try changing "[Resolution].Visible = False" to "[Resolution].Visible = True".

-1, I believe, is the value of True. In the code, if the box is checked the Visible property is set to False.

 
As CosmoKramer suggested, the code needs to go in the report. You can use syntax like:

Me.[Resolution].Visible = Forms![frmSelectProj]![ResolutionCheck] = -1




Duane
MS Access MVP
 
See my post above



A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
Douglas Adams
 
One problem with putting it there, as I go to the next page of the report it looks for the form that had the check mark. That form closes as the report opens. So I get an error.
 
See if it will work in the On Open event....



A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
Douglas Adams
 
Or, leave the form open but set it to invisible.

Duane
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top