Solved SetProperty to disable external control

Sarah.M

Member
Local time
Today, 18:30
Joined
Oct 28, 2021
Messages
335
Hi, Plz note, My VBA is blocked by IT for security reason.
I can use only Expression builder, Macros, Queries, Tables, Forms and Reports only.
------------------------------------------------
Hi, I have main form has a button this button open another form in Add Mode, I want to use SetProperty to disable externally Tab1 from that button, I use select object, but still dose not work :(
plz help me to fix it 🙏

Sample attached
 

Attachments

Last edited:
as long as form2 is not modal, use the full path to disable:

open "form2",,,,acFormAdd
forms!form2!tap1.enabled = false
 
Your question references Tap1 but I assume you meant Tab1.

Why not set Tab1 as Enabled No in its design then enable it when needed? Have AddNewMeeting form manage its controls. Use combobox AfterUpdate event.

@Ranman256 - already tried that and macro still errors. OP cannot use VBA.
 
Last edited:
as long as form2 is not modal, use the full path to disable:

open "form2",,,,acFormAdd
forms!form2!tap1.enabled = false
Thanks for replying
it dose not work I got error message
plz help

1647245715496.png
1647245677280.png
 
Your questions references Tap1 but I assume you meant Tab1.

Why not set Tab1 as Enabled No in its design then enable it when needed? Have AddNewMeeting form manage its controls.
Thanks for replying
Because I will use 2 buttons
Button 1 it is going to open AddNewMeeting form in Add Mode, if it is in Add mode enabled will be step by step
Button 2 it is going to open AddNewMeeting form in Edit Mode, if it is in Edit Mode everything will be enabled
plz help
 
Then set a TempVars variable that indicates which mode is desired and AddNewMeeting checks that variable when it opens and sets its controls appropriately. Use If Then in macro.

Can also use Conditional Formatting to enable/disable textboxes and comboboxes. Conditional Formatting rules can reference TempVars variable.

As far as I can tell, the 'external' reference you want won't work.
 
Then set a TempVars variable that indicates which mode is desired and AddNewMeeting checks that variable when it opens and sets its controls appropriately. Use If Then in macro.

Can also use Conditional Formatting to enable/disable textboxes and comboboxes. Conditional Formatting rules can reference TempVars variable.

As far as I can tell, the 'external' reference you want won't work.
Thanks for replying,
Kindly, do you have sample plz?
 
I understand their usage but have never used TempVars and macros in my dbs. So I don't have sample. I have seen tutorials that demonstrate. Do research and should find.
 
here is the macro adding Tempvars.
 

Attachments

here is the macro adding Tempvars.
Wow It works!,
but how this magic is happened can you give me some explanation? plz 🙏
how "Edit" as text change the Mode and make Tab1 disabled there?
how Tab1 become disable I did not see "False" in value section?
How "Edit" become "False" in value section? 🤯
I am surprised :oops:
 
Last edited:
the first form set the tempvar to "Add" or (if you add another button, you set it to "Edit").
the second form, catches the tempvar on the Load Event.

([TempVars]![tvarOpenMode] = "Edit") will result in either True or False, depends what is the value of tvarOpenMode.
 
the first form set the tempvar to "Add" or (if you add another button, you set it to "Edit").
the second form, catches the tempvar on the Load Event.

([TempVars]![tvarOpenMode] = "Edit") will result in either True or False, depends what is the value of tvarOpenMode.
I am still surprised,
1 TempVars gives 2 jobs
because, what I know Value section can take True False, Yes No, -1 0, I never read that Value can take Add as True and Edit as False 🤯

Thanks!!!
 
It is not taking Add as True and Edit as False. The equality expression is returning either True or False result. That result is setting property.
 
It is not taking Add as True and Edit as False. The equality expression is returning either True or False result. That result is setting property.
For example ([TempVars]![tvarOpenMode] = "Blue") setProperity Value ([TempVars]![tvarOpenMode] = "Red")
He will consider that Blue is True and Red is False? or it means anything written first will be considered as True? How does MS Access knows that "add" means True?
This topic is interesting to me kindly explain more to me plz 🙏
 
The TempVars!tvarOpenMode is set to either "Add" or "Edit" in button click. Then used in equality expression ([TempVars]![tvarOpenMode] = "Edit"). That expression calculates to either True or False. If the TempVar has been set to "Add" then the result is False because "Add" does not = "Edit". If TempVar has been set to "Edit" then the result is True because "Edit" is = to "Edit".
 
The TempVars!tvarOpenMode is set to either "Add" or "Edit" in button click. Then used in equality expression ([TempVars]![tvarOpenMode] = "Edit"). That expression calculates to either True or False. If the TempVar has been set to "Add" then the result is False because "Add" does not = "Edit". If TempVar has been set to "Edit" then the result is True because "Edit" is = to "Edit".
Thanks for the clarification!!!
 

Users who are viewing this thread

Back
Top Bottom