vba code used on parameter?

  • Thread starter Thread starter GregB
  • Start date Start date
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
 
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
 
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????
 
Back
Top