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

Text Box Appearance Condition

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
The Access 2000 database that I'm working on prints customer invoices. I'm trying to setup a report so that if the ClientID field in the Client table reads "ABC", then a dialog box will display on the report reading "unique payment plan (see notes)". If the ClientID field equals anything other than "ABC", then this dialog box should say "Charge Account". Below is the syntax that I have, but it does not work.


If Tables!Client.ClientID = "ABC" Then
Me.txtbox.FontWeight = 700
Me.txtbox.ForeColor = RGB(255, 0, 0)
Me.txtbox.Caption = "Unique Payment Plan (see notes)"
Else
Me.txtbox.FontWeight = 700
Me.txtbox.ForeColor = RGB(255, 0, 0)
Me.txtbox.Caption = "Charge Account"

End If


Appreciate any help.

Mike
 
Hello,
Textboxes do not have a caption property. You will want to use the text property. HTH, [pc2]
Randy Smith
California Teachers Association
 
I've made that change, but still it will not work. Is my reference to the table correct, or do you see anything else?

Thanks.


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

If Tables!Groups.GroupID = "CST" Then
Me.txtbox.FontWeight = 700
Me.txtbox.ForeColor = RGB(255, 0, 0)
Me.txtbox.Text = "CD"
Else
Me.txtbox.FontWeight = 700
Me.txtbox.ForeColor = RGB(255, 0, 0)
Me.txtbox.Text = "Diskette"

End If

End Sub
 
Sorry, I posted the wrong code. Here is the updated code:



If Tables!Client.ClientID = "ABC" Then
Me.txtbox.FontWeight = 700
Me.txtbox.ForeColor = RGB(255, 0, 0)
Me.txtbox.Text = "Unique Payment Plan (see notes)"
Else
Me.txtbox.FontWeight = 700
Me.txtbox.ForeColor = RGB(255, 0, 0)
Me.txtbox.Text = "Charge Account"

End If
 
Actually,
You should not be referencing the table in your Detail print section. You can refer directly to the field on your report:
If ClientID = "ABC" Then....

You may want to look at my FAQ on how to change the format of a text box. faq703-2679

AND, I wrote an FAQ on how to change the colors in a form or a report.
faq702-2711

You will notice that I didn't have to reference Me.txtbox..... HTH, [pc2]
Randy Smith
California Teachers Association
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top