OpenAugs on form load event (1 Viewer)

rdw456

Novice
Local time
Today, 03:39
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:39
Joined
Oct 29, 2018
Messages
21,357
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?
 

June7

AWF VIP
Local time
Today, 02:39
Joined
Mar 9, 2014
Messages
5,423
Because you have an error handler that is trapping errors and, apparently, preventing error messages.

What happens in the procedure GeneralErrorHandler?

Step debug.
 

Micron

AWF VIP
Local time
Today, 06:39
Joined
Oct 20, 2018
Messages
3,476
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.
 

June7

AWF VIP
Local time
Today, 02:39
Joined
Mar 9, 2014
Messages
5,423
Right, good point, procedure won't even run in Access 2010. So more mystery.
 

Users who are viewing this thread

Top Bottom