Go Back   Access World Forums > Microsoft Access Discussion > Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 03-14-2019, 01:24 PM   #1
rdw456
Novice
 
Join Date: Jul 2012
Location: Nova Scotia, Canada
Posts: 41
Thanks: 7
Thanked 0 Times in 0 Posts
rdw456 is on a distinguished road
OpenAugs on form load event

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

rdw456 is offline   Reply With Quote
Old 03-14-2019, 01:46 PM   #2
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 32,770
Thanks: 11
Thanked 4,015 Times in 3,952 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: OpenAugs on form load event

An alternative:

http://www.baldyweb.com/OpenArgs.htm
__________________
Paul
Microsoft Access MVP

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 03-14-2019, 01:46 PM   #3
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 2,131
Thanks: 25
Thanked 551 Times in 539 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: OpenAugs on form load event

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?

__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 03-14-2019, 01:55 PM   #4
June7
Newly Registered User
 
June7's Avatar
 
Join Date: Mar 2014
Posts: 1,656
Thanks: 0
Thanked 407 Times in 404 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: OpenAugs on form load event

Missing closing paren.
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
Old 03-14-2019, 02:02 PM   #5
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 2,131
Thanks: 25
Thanked 551 Times in 539 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: OpenAugs on form load event

Quote:
Originally Posted by June7 View Post
Missing closing paren.
Good eye! Makes sense...
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 03-14-2019, 04:05 PM   #6
Tera
Newly Registered User
 
Join Date: Feb 2019
Posts: 144
Thanks: 218
Thanked 7 Times in 7 Posts
Tera is on a distinguished road
Re: OpenAugs on form load event

Quote:
Originally Posted by June7 View Post
Missing closing paren.
why the code runs at all? with no errors?
Tera is offline   Reply With Quote
Old 03-14-2019, 05:27 PM   #7
June7
Newly Registered User
 
June7's Avatar
 
Join Date: Mar 2014
Posts: 1,656
Thanks: 0
Thanked 407 Times in 404 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: OpenAugs on form load event

Because you have an error handler that is trapping errors and, apparently, preventing error messages.

What happens in the procedure GeneralErrorHandler?

Step debug.

__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
Old 03-14-2019, 08:35 PM   #8
Micron
Newly Registered User
 
Join Date: Oct 2018
Location: Ontario, Canada
Posts: 433
Thanks: 2
Thanked 85 Times in 81 Posts
Micron will become famous soon enough Micron will become famous soon enough
Re: OpenAugs on form load event

Quote:
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.
__________________
Sometimes I just roll my eyes out loud...
Windows 10; Office 365 (Access 2016)
Micron is online now   Reply With Quote
Old 03-14-2019, 08:57 PM   #9
June7
Newly Registered User
 
June7's Avatar
 
Join Date: Mar 2014
Posts: 1,656
Thanks: 0
Thanked 407 Times in 404 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: OpenAugs on form load event

Right, good point, procedure won't even run in Access 2010. So more mystery.

__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow Form load event liamfitz Forms 1 03-11-2013 11:26 AM
Form On Load event question SpiritedAway Forms 1 06-22-2011 11:47 AM
Query On form Load event khan33 Forms 1 06-05-2011 03:57 PM
Add Item to List Box on Form Load Event crhodus Modules & VBA 4 07-02-2003 08:10 AM




All times are GMT -8. The time now is 01:48 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World