Douglas tried renaming both text boxes but failed to work, Here is my
actual code I have a few other .Visible text boxes that all work
fine...Thanks bob
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo ProcError
lbBankName.Visible = Len([tbDirectBank] & vbNullString) > 0
lbBranch.Visible = Len([tbDirectBank] & vbNullString) > 0
lbAccountName.Visible = Len([tbDirectBank] & vbNullString) > 0
lbAccountNumber.Visible = Len([tbDirectBank] & vbNullString) > 0
lbTopLabel.Visible = Len([tbDirectBank] & vbNullString) > 0
lbEmailBank.Visible = Len([tbDirectBank] & vbNullString) > 0
lbBankCode.Visible = Len([tbDirectBank] & vbNullString) > 0
Line116.Visible = Len([tbDirectBank] & vbNullString) > 0
Line117.Visible = Len([tbDirectBank] & vbNullString) > 0
Line118.Visible = Len([tbDirectBank] & vbNullString) > 0
Line108.Visible = Len([tbDirectBank] & vbNullString) > 0
lbCheque.Visible = Len([tbChequePayableTo] & vbNullString) > 0
BoxC1.Visible = Len([tbCreditCard1] & vbNullString) > 0
BoxC2.Visible = Len([tbCreditCard1] & vbNullString) > 0
BoxC3.Visible = Len([tbCreditCard1] & vbNullString) > 0
tbCreditCard2.Visible = Len([tbCreditCard1] & vbNullString) > 0
tbCreditCard3.Visible = Len([tbCreditCard1] & vbNullString) > 0
lbName.Visible = Len([tbCreditCard1] & vbNullString) > 0
lbExpiry.Visible = Len([tbCreditCard1] & vbNullString) > 0
lbSignature.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box136.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box137.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box138.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box139.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box140.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box142.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box143.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box144.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box145.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box146.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box147.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box148.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box149.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box150.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box152.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box153.Visible = Len([tbCreditCard1] & vbNullString) > 0
Box154.Visible = Len([tbCreditCard1] & vbNullString) > 0
lbCreditCard.Visible = Len([tbCreditCard1] & vbNullString) > 0
Line169.Visible = Len([tbCreditCard1] & vbNullString) > 0
Line170.Visible = Len([tbCreditCard1] & vbNullString) > 0
BoxC2.Visible = Len([tbCreditCard2] & vbNullString) > 0
BoxC3.Visible = Len([tbCreditCard3] & vbNullString) > 0
Me!tbOverdueNotice.Visible = (Nz(Me![tbOverdueVisible], "No") = "Yes")
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Detail_Format..."
Resume ExitProc
End Sub
Douglas J. Steele said:
Sorry, my typo. The Nz should definitely not have been there
Debug.Print Nz([tbOverdue] & " (" & TypeName([tbOverdue]) & ")"
That having been said, there's no logical reason why the code shouldn't
be working as expected!
Is tbOD the name of the field to which the text box is bound? If so, try
renaming the text box. As well, try using
Me!tbOD.Visible = (Nz(Me![tbOverdue], "No") = "Yes")
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Bob V said:
Douglas I got this Result:
Yes (String
Yes (String
Changed your code format slightly:
Debug.Print Nz([tbOverdue]) & " (" & TypeName(Nz([tbOverdue]) & ")")
tbOD.Visible = (Nz([tbOverdue], "No") = "Yes")
Thanks ...Bob
Douglas I am getting Red Font Error on the first line:
Debug.Print Nz([tbOverdue] & " (" & TypeName(Nz([tbOverdue]) & ")"
Thanks Bob
message Are you sure that tbOverdue is returning strings?
For test purposes, try:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo ProcError
Debug.Print Nz([tbOverdue] & " (" & TypeName(Nz([tbOverdue]) & ")"
tbOD.Visible = (Nz([tbOverdue], "No") = "Yes")
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Detail_Format..."
Resume ExitProc
End Sub
After your report has run, go to the Immediate Window (Ctrl-G) and see
what's been printed there.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Douglas does this look Right to you?...Thanks Bob, I can not get tbOD
to dissapear!
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo ProcError
tbOD.Visible = (Nz([tbOverdue], "No") = "Yes")
ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure Detail_Format..."
Resume ExitProc
End Sub
message The Len function tells you how long a string is. If you're trying to
check the value of a string, you don't use the Len function.
tbOD.Visible = (([tbOverdue] & vbNullString) = "Yes")
or
tbOD.Visible = (Nz([tbOverdue], "No") = "Yes")
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
Douglas I changed my Combo Box on my form to text with a value of
Yes;No. So my text box on the Report will either show Yes or No. If
I want the text box to be visible on [Yes] what code would I need
and where should I put it.....Thanks Bob
tbOD.Visible = (Len([tbOverdue] & vbNullString) = "Yes") ????
message No, it's not right.
First of all, that's attempting to set the visibility of tbOD (the
check box) based on the length of whatever text is in text box
tbOverdue. But it's doing it incorrectly, since Len returns a
number, and you're comparing it to a text string.
To set the visibility of text box tbOverdue based on whether or
not check box tbOD is checked, use
tbOverdue.Visible = tbOD
If you did want only to make the check box visible if there was
text in the text box, you'd use:
tbOD.Visible = (Len([tbOverdue] & vbNullString) > 0)
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
Is this right?
tbOD.Visible = Len([tbOverdue] & vbNullString) = "-1"
If tbOD is ticked (-1) the textbox tbOverdue will show on my
report???
Thanks for any help...........Bob