OpenAugs on form load event

rdw456

Novice
Local time
Today, 02:26
Joined
Jul 20, 2012
Messages
43
this works Me.FirstName = Left(FirstName, InStr(FirstName, Chr(32)) - 1)
This does not Me.Surname = Right(Surname, InStr(Surname, Chr(32)) -1

So cant figure it out any idea's

Thanks Bob

Code
--------------------------------------------------------------------------------------
Private Sub Form_Load()

On Error GoTo HandleError

If Not IsNull(Me.OpenArgs) Then
' If form's OpenArgs property has a value, assign the contents
' of OpenArgs to the CompanyName field. OpenArgs will contain
' a Customers name if this form is opened using the OpenForm
' method with an OpenArgs argument CustomerID_NotInList event
' procedure.

Me.FirstName = Me.OpenArgs
Me.Surname = Me.OpenArgs

Me.FirstName = Left(FirstName, InStr(FirstName, Chr(32)) - 1)
Me.Surname = Right(Surname, InStr(Surname, Chr(32)) -1

End If

Exit Sub

HandleError:
If Error <> 0 Then
Resume Next
Else
GeneralErrorHandler Err.Number, Err.Description, "modBusinessLogic", _
"Form_Load"
Resume Next
End If

Exit Sub

End Sub
 
Hi. What does "does not work" mean? What are you getting with your code and what are you expecting? Can you show us what the OpenArgs look like?
 
Because you have an error handler that is trapping errors and, apparently, preventing error messages.

What happens in the procedure GeneralErrorHandler?

Step debug.
 
Because you have an error handler that is trapping errors
It still shouldn't run at all. I can find no error trapping or compile option setting that will allow it. Not only is it red, it just won't run for me, so it's not just a run-time error in version 2016.
 
Right, good point, procedure won't even run in Access 2010. So more mystery.
 

Users who are viewing this thread

Back
Top Bottom