Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Validate part of string

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?
--
Thanks for your help.
Karen53
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Validate part of 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

"Karen53" wrote in message
...
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?
--
Thanks for your help.
Karen53



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Validate part of string

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


"Tim Williams" wrote:

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

"Karen53" wrote in message
...
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?
--
Thanks for your help.
Karen53




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula to validate characters within a string of data in aparticular cell Mackay Excel Discussion (Misc queries) 1 July 7th 11 03:30 PM
Need formula to locate and validate specific text from a string vinstream Excel Discussion (Misc queries) 11 April 7th 10 12:52 PM
Search/Match/Find ANY part of string to ANY part of Cell Value TWhizTom Excel Worksheet Functions 0 July 21st 08 08:16 PM
part of string [email protected][_2_] Excel Programming 3 November 17th 05 12:22 PM
Use part of string Tempy Excel Programming 5 September 20th 05 11:44 AM


All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"