If then statement

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

Guest

Hello,
I need to create code in which the beginning of a field starts with the
words "No
Solution Yet". I can write the code if the entire field equals "No Solution
Yet" (see below), however I can't figure out how to do it if it just begins
with these terms.

If Me.Solution = "No Solution Yet" Then
strMsg = strMsg & "Solution needs to be documented"
MsgBox strMsg, vbExclamation, "Invalid Data"

Any assistance would be greatly appreciated.
 
hi,
I need to create code in which the beginning of a field starts with the
words "No
Solution Yet". I can write the code if the entire field equals "No Solution
Yet" (see below), however I can't figure out how to do it if it just begins
with these terms.

If Me.Solution = "No Solution Yet" Then
strMsg = strMsg & "Solution needs to be documented"
MsgBox strMsg, vbExclamation, "Invalid Data"

If InStr(Me.Solution, "No Solution Yet") = 1 Then
MsgBox strMsg
End If


mfG
--> stefan <--
 
Stefan's solution will also only find it at the beginning of the string,
since he's checking if InStr finds it at position 1.
 
Douglas said:
Stefan's solution will also only find it at the beginning of the string,
since he's checking if InStr finds it at position 1.
Which, of course, is "the beginning of a field" :)


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top