Validate part of string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm not sure how to go about this. I need to validate a textbox. Any value
can be in the textbox but if certain values are there they need to be the
first item in the box and 3 of them must be spelled correctly. The items:
"Major", "Major Tenant", & "Anchor" must be spelled correctly, but they can
have additional information after them.

Here's what I have so far:

i = InStr(frmStoreData.txtAddUnitNos, "Maj")
If i <> 1 Then
MsgBox ("Major must be the first item listed")
Good = False
End If

i = InStr(frmStoreData.txtAddUnitNos, "Anc")
If i <> 1 Then
MsgBox ("Anchor must be the first item listed")
Good = False
End If

i = InStr(frmStoreData.txtAddUnitNos, "Pad")
If i <> 1 Then
MsgBox ("Pad must be the first item listed")
Good = False
End If

i = InStr(frmStoreData.txtAddUnitNos, "Ret")
If i <> 1 Then
MsgBox ("Retail must be the first item listed")
Good = False
End If

How would I check the spelling for just that portion of the string?
 
It might be easier to place a listbox containing the items "Major","Major
Tenant", etc before the textbox, and allow the user to select from that list
if appropriate before typing any additional text in the textbox. Then just
concatenate the selected list item with the textbox contents.

Tim
 
Thank you, Tim.
--
Thanks for your help.
Karen53


Tim Williams said:
It might be easier to place a listbox containing the items "Major","Major
Tenant", etc before the textbox, and allow the user to select from that list
if appropriate before typing any additional text in the textbox. Then just
concatenate the selected list item with the textbox contents.

Tim
 
Back
Top