If textbox = numbers then hide

DuMont

Registered User.
Local time
Today, 11:47
Joined
Jul 31, 2014
Messages
24
Hi there,

I have a report in which a textbox generates numerical values and letter values.

I want to...On report load - if textbox = numbers then hide otherwise show if it contains letter values.

How would I go about doing this?

Thanks!:)
 
Welcome to the forum! If you've not already been welcomed :)

Looks like we'll need more info. Is this textbox bound to any field?
 
Thanks :)

The textbox is bound to a control source yes - PatientName
 
I don't know that this would work but I would first try some code the On Format event using If Then and IsNumeric() function (Returns true if it is numeric) to determine the kind of data
EDIT
Sorry guys, missed the last two posts while I was typing this post (at my usual snails pace of course)
 
Instead of hiding the box (which can be done), don't include those values in the Record Source of your report.

Use the function bob fitz mentioned in the Record Source of your report like this:
Code:
[COLOR="Red"]NewFieldName[/COLOR]: IIF(IsNumeric([[COLOR="blue"]FieldName[/COLOR]]), Null, [[COLOR="Blue"]FieldName[/COLOR]])
Put this in the query replacing FieldName with the name of the field.
 
Thanks for the replys!

But I think I'm a little lost - I just want this to happen with the on report load. As far as changing the entire query, I have over 100 tables all union - are you saying that i need to add that line to every instance?

I tried to just change the control source to what you suggested but it didn't work :confused:
 
No just the field. It's better to have it in the record source but you can put it in the Control Source of the textbox as well:
Code:
=IIF(IsNumeric([[COLOR="Blue"]FieldName[/COLOR]]), Null, [[COLOR="blue"]FieldName[/COLOR]])
The highlighted parts are meant for you to amend to the correct field name.
 
Ohh I gotcha that worked perfectly.

You sir are a genius! Thanks bob & vba!
 

Users who are viewing this thread

Back
Top Bottom