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

Reference to Text field and display information.

Status
Not open for further replies.

paul123456

Technical User
Apr 29, 2002
518
US
I have some reports that i would like to display different data depening on what the first two letters of a field are.. IE if the field starts with TX i would like to display a different ="text " field in the report but if it starts CA then it displays ="differenttext"?? how can i go about doing this? this will save me from having to create 2 of the same reports with different wording.

Thanks, PAUL

 
Here is what I would do:

1) Have the text field hidden on the report

2) Add a label and place it where I want the text field displayed

3) Put this code in the On Format event of the report detail

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Select Case Left(YourField,2)
        Case "TX"
            YourFieldLabel.Caption = "Texas"
        Case "CA"
            YourFieldLabel.Caption = "California"
    End Select

End Sub

HTH
Mike

[penguin] Dooobie...Doobie......Dooo

Beware the penguins
 
I made it a little easier for me..i created a field called state codes..

i want to do this...IIF([Statecode]=CA,California) or IIF([stateCode]=TX,Texas)

if statecode is equal to ca then display california..and if statecode =tx then display texas as text???

am i close?

Thanks, PAUL

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top