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,598
Thanks: 10
Thanked 3,971 Times in 3,909 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: 1,126
Thanks: 11
Thanked 257 Times in 251 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,375
Thanks: 0
Thanked 333 Times in 333 Posts
June7 will become famous soon enough
Re: OpenAugs on form load event

Missing closing paren.
__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.
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: 1,126
Thanks: 11
Thanked 257 Times in 251 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: 92
Thanks: 119
Thanked 4 Times in 4 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,375
Thanks: 0
Thanked 333 Times in 333 Posts
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.

__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.
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: 264
Thanks: 2
Thanked 48 Times in 46 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.
__________________
Windows 10; Office 365 (Access 2016)
Micron is offline   Reply With Quote
Old 03-14-2019, 08:57 PM   #9
June7
Newly Registered User
 
June7's Avatar
 
Join Date: Mar 2014
Posts: 1,375
Thanks: 0
Thanked 333 Times in 333 Posts
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.

__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.
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 09:03 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