code

  • Thread starter Thread starter rml
  • Start date Start date
R

rml

What would the code look like for the following:

If [field] starts with a numeric value ("2 test") then
Do something

also

If [field]] starts with "kit" ("kit ver. 3) then
Do something
 
The Val function is used to convert a string to a number. It stops looking
as soon as it finds a character that can't be converted to a number. For
example:
Val("2 test") will return 2
Val("A Test") will return 0
So:

If Val([field]) > 0 Then
'Starts with a number
Else
'Starts with something other than a number
End If

Also,

If Left([field],3) = "kit" Then
'Do Something
End If
 
Back
Top