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

Conditional formatting 1

Status
Not open for further replies.

santastefano

Programmer
Aug 9, 2005
54
IT
Is it possible to format the contents of a text box on a form according to the results of a DLookup to the contents of another text box on the same form? I should also advise that this form is populated from a query and goes straight to print It is never seen by the user. I am trying to avoid putting another set of forms into the application.

I have tried the conditional formatting wizard and an If-Then statement in both the forms open event and the text box on dirty event without success.

Any pointing in the right direction?

Thanks in advance
 
It would probably help to know what type of formatting you are trying to do. Why are you using a DLookup() if the value is on the same form?

Paul
 

What is the point of formatting a text box that is never seen by the user? If it's something you need for a report, why not format it in the query?


Randy
 
Thanks to both.
The form is an invoice.
Some clients are registered to pay sales tax and it is then necessary to note the sales tax reference number on the form.

Currently the set up is that if the client is not registered then the reference number is null and the field is blank but the local language translation of the label (for example "Sales tax registration") still appears.

Of course I can just produce a duplicate set of forms and run them according to the sales tax status but I was hoping for a programming solution.
Best regards
 
So what you want to do is hide the label? Does the field fill automatically if there is a reference number on the other form? If it fills in automatically, then you might be able to use the Forms Current event to turn the label on and off.

If IsNull(Me.txtTaxNumberField) Then
Me.LabelName.Visible = False
Else
Me.LabelName.Visible = True
End If

HTH

Paul
 
Thank you PaulBricker
Your solution was not quite OK for my application BUT clearly close enough to play around with a little. Substituting DLookup into the if statement in the forms Current event box works perfectly.
I didn't think of the Visible/Invisible switch for this problem so thank you very much or Grazie Mille as we say here.
Best regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top