vba code used on parameter?

G

GregB

I have some VBA code
If Me.Serial_Number Like "S*" Then
Me.Serial_Number = Right(Me.Serial_Number, Len(Me.Serial_Number) - 1)
End If

It is set up under the "on current" event
When a user accesses the form they are prompted to input the serial number
they are looking for by a parameter.
I can't get my code to take trim the S off of what they enter into the
paramater...
What am I doing wrong?
Thanks
 
J

John Spencer

Are you getting an error message?
Is the code running at all?
Where do you have the code you are showing? - That snippet is out of context
so we have no way of knowing if it is even running.


IF Me.SerialNumber Like "S*" THEN
Me.SerialNumber = Mid(Me.SerialNumber,2)
END IF

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
M

MikeJohnB

Untested but try

Dim StrgTemp as String

If Me.Serial_Number Like "S*" Then
StrgTemp = Right(Me.Serial_Number, Len(Me.Serial_Number) - 1)
Me.Serial_Number = StrgTemp
End If

Hope this helps????
 

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

Top