Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-16-2019, 06:38 AM   #31
Micron
Newly Registered User
 
Join Date: Oct 2018
Location: Ontario, Canada
Posts: 797
Thanks: 10
Thanked 161 Times in 155 Posts
Micron will become famous soon enough Micron will become famous soon enough
Re: Get value of Link Master Field

Quote:
Originally Posted by Uncle Gizmo View Post
So why not the values of Custom Properties?
I stated why not (The property value isn't assigned until execution returns to form1...) which simply means your attempt is late, but I guess SomeSmurf stated it more clearly. However, OpenArgs IS a property of a form. Its value is passed to the opening form without having to write a custom property for the same purpose.
Quote:
I suspect it's deliberate , (or possibly a mistake!) In one way it makes a lot of sense, if you are using custom properties m, then you are taking control of the situation, and adding your own function to apply the custom properties is just another step up in this control you are exercising. In other words, you're not relying on the built-in functionality of the form ...
Sent from my Pixel 3a using Tapatalk
Sorry, I don't buy into that at all, or your prior statements about "abusing" OpenArgs or it being less clear or somehow not being able to separate the values. We just have different opinions on the matter, I guess.

__________________
Sometimes I just roll my eyes out loud...
Windows 10; Office 365 (Access 2016)
Micron is offline   Reply With Quote
Old 07-16-2019, 08:21 AM   #32
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 10,161
Thanks: 493
Thanked 902 Times in 854 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: Get value of Link Master Field

Quote:
Originally Posted by Micron View Post
your prior statements about "abusing" OpenArgs or it being less clear or somehow not being able to separate the values.
I stand by that. I never did like trying to cram loads of variables through in an OpenArgs string, it's just not right. A very clever workaround though ...

Sent from my Pixel 3a using Tapatalk
__________________
Code:
                 |||||
               @(~^~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is online now   Reply With Quote
Old 07-16-2019, 02:46 PM   #33
Uncle Gizmo
Nifty Access Guy
 
Uncle Gizmo's Avatar
 
Join Date: Jul 2003
Location: Newbury Berks UK
Posts: 10,161
Thanks: 493
Thanked 902 Times in 854 Posts
Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough Uncle Gizmo is a jewel in the rough
Send a message via Skype™ to Uncle Gizmo
Re: Get value of Link Master Field

Quote:
Originally Posted by Micron View Post
OK, I watched the vid. I get what you're doing but I would use other methods such as OpenArgs to pass the value to the control, or just make mTest public and code as below. The behaviour that you say is unexpected may be to some at first, but it is exactly what I'd expect and it makes perfect sense.

The property value isn't assigned until execution returns to form1 where you have .prpTest = "TEST". It is too late now because the form2 events that attempt to set the control value are not going to run again after you define what they should have used as a value. To me, this is just how code executes when control passes from one form or procedure to another.

Obviously you're not going to change the way you do things just because I don't see an issue. After all, your fSetup is only 3 lines long.
Here's how if the property declaration was Public (not going to bother with OpenArgs):
Code:
DoCmd.OpenForm "frm2"
Forms!frm2.mTest = "TEST"
With Forms!frm2
    .txtShowResult = .prpTest
End With

I'm not happy with the idea of making the custom property variable public. In any event it's not necessary because just a slight change to your example:-

Code:
DoCmd.OpenForm "frm2"
Forms!frm2.prpTest = "TEST"
With Forms!frm2
    .txtShowResult = .prpTest
End With

And it works fine...

__________________
Code:
                 |||||
               @(~^~)@
-------------oOo---U---oOo-------------
|                                     |
|      Uncle Gizmo              |
|                                     |
|                                     |
| Get $20 worth of "Nifty Code"       |
|      
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
| | Ooo | |_________________ooO____( )________| ( ) ) / \ ( (_/ \_)
Uncle Gizmo is online now   Reply With Quote
Old 07-17-2019, 01:59 AM   #34
MajP
Newly Registered User
 
Join Date: May 2018
Location: USA baby
Posts: 1,676
Thanks: 27
Thanked 505 Times in 478 Posts
MajP will become famous soon enough MajP will become famous soon enough
Re: Get value of Link Master Field

OpenArgs and custom properties is an apples and oranges discussion. OpenArgs is a workaround for a limitation in Access that custom properties cannot address. The only time OpenArgs is needed (and required) is if you open a form in ACDIALOG. Because code execution stops in the calling form there is no way to pass anything to the called form. OpenArgs works like a parameterized constructor where you can pass in a value at instantiation. If you do not open the form ACDIALOG then custom properties or other solutions are available. I agree, if you do not open ACDIALOG then overusing OpenArgs is not a good approach.
Working in something more modern like VB.NET is much simpler because you can set properties of the form before opening the form. So for example you can set the value of a textbox before even opening the form in a dialog mode. The purpose ofOpenArgs is a workaround for the limitation in Access or not being able to set these properties before opening in a modal/dialog mode where code execution is given to the called form.

MajP is online now   Reply With Quote
The Following User Says Thank You to MajP For This Useful Post:
Uncle Gizmo (07-17-2019)
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to link master field to textbox on main form evoingram Modules & VBA 1 11-21-2016 04:50 PM
Revising Data In Link child & Link Master Field duffy Forms 2 04-19-2009 05:35 PM
Link master field, on another subreport Gkirkup Reports 1 04-03-2009 01:15 AM
Setting Link Master Field in VB mnbuckland Modules & VBA 2 12-08-2008 10:00 PM
Making the Subform Master Field Link a Control ^Nightwing^ Forms 0 09-21-2004 02:46 AM




All times are GMT -8. The time now is 11:58 AM.


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