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

Converting a text string 1

Status
Not open for further replies.

infomania

Programmer
Oct 27, 2002
148
I would like have a function to convert a user entered, comma separated, text string to a proper text string to be used in a WHERE clause.

Example:

Dim strInput, strConvInput, strSQL As String

strInput = Me.BoLInput ' user entered string

' user string looks like: 123a, 134D, 115,123
' user could enter spaces after comma

' use function to convert strInput 'to '123a','134D','115','123'

strConvInput = ConvFunct(strBoLInput)

strSQL = "UPDATE tblInbound SET XferCustID = " & Me.XferCustID
strSQL = strSQL + " WHERE BoL_IN IN (" & strConvInput & ")"
DoCmd.RunSQL strSQL

Any ideas?




 
If the users entered space after comma

[tt]dim strString as string
strString = "23a, 134D, 115, 123"
strString = "'" & join(split(strstring,", "),"', '") & "'"[/tt]

I'd never allow user input like that, and think it would be much better to use a multiselect listbox, and an approach something like this thread702-787778?

Roy-Vidar
 
Roy

Thank you... I think I will use the multiselect listbox approach. These users make lots of typos. The info in the referenced thread is just what I need.

Infomania
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top