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

Hide a field in a report... 2

Status
Not open for further replies.

DaveShmave

Programmer
Dec 30, 2000
40
US
I just did a search for what I'm trying to do but haven't had any luck.

I have a text field in a report (Access 2000 SR-2) that contains numeric and alpha information. Let's call the field "Code". Any valid "Code" starts with a numeric value, however, invalid codes start with an alpha character.

What I want to do is simply make the field null anytime one of the codes starts with an alpha character. You see, I don't want to eliminate that record or the rest of the data for that record from the report, just hide the invalid codes.

How can I do this in the Detail_Format section (or wherever) of the form? Or am I better using an IIF statement in the text field (control) on this report?

TIA

Dave X-)
 
I'm doing something similiar with an Access 97 report I'm designing right now. You can put code in the On_Format section of the report to make the field invisible.

Something like
If <blahblahblah alpha> then
me!Code.visible = false
else
me!Code.visible = true
End if

Sorry, I'm not sure of the exact syntax for determining if the first character is alpha. Shouldn't be too hard though. Maq B-)
<insert witty signature here>
 
You can set this in the control source to inspect the field and place the value if the first character in the string is a number, or put &quot;&quot; if it's not. Make sure the name of the control is not [MyField], or you'll get #Error for a result.

=IIf(IsNumeric(Left([MyField],1))=TRUE,[MyField],&quot;&quot;)

HTH Joe Miller
joe.miller@flotech.net
 
Syntax searching for alpha is easy.

if asc(field)>=65 and asc(field)<=90 then
me!Code.visible = false
elseif asc(field)>=97 and asc(field)<=122 then
me!Code.visible = false
else
me!Code.visible = true
end if

HTH

Craig
 
Thanks Maq, Joe and Craig!

I'll look into all of your suggestions.

Dave ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top