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

I have a text field AnesNum that ca

Status
Not open for further replies.

mxp346

MIS
Apr 27, 2002
50
US
I have a text field AnesNum that can include several ID numbers. If the ID number 111 is include in this set of numbers, I want the text field OtherAnesType to become visible. The following code works if I type in *111* but not if I type in 111 or 111, 123. The help file said that * can be used as a wildcard but it's not working. Any ideas?


Code:
Private Sub AnesNum_AfterUpdate()

If AnesNum = "*111*" Then
    OtherAnesType.Visible = True
Else
    OtherAnesType.Visible = False
End If

End Sub

Thanks for the help, Matt
 
well, first change i would make is this... put a me. in front of the AnesNum...

Private Sub AnesNum_AfterUpdate()

If me.AnesNum = "*111*" Then
me.OtherAnesType.Visible = True
Else
me.OtherAnesType.Visible = False
End If

End Sub
JHauge@jmjpc.net
Life is change. To deny change is to deny life.
 
I added in the Me. but it still only becomes visible if I type *111*. Any other suggestions?
 
Hi!

Use this code:

If Me!AnesNum Like "*111*" Then etc.

One quick question, do you need the wildcards because different numbers will be typed like 111F or G111H2? If the only number that will be typed is 111 then just use If Me!AnesNum = "111".

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thank you very much jerby, adding the like in there worked. I needed the wildcard because there are different numbers that included 111, things along the line of what you mentioned... 111F or G111H2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top