Solved SetTempVar to Run Requery or Refresh on other form

Sarah.M

Member
Local time
Today, 02:37
Joined
Oct 28, 2021
Messages
335
Hi, Plz note, My VBA is disabled for security reason.
I can use only Expression builder, Macros, Queries, Tables, Forms and Reports only.
------------------------------------------------
I have 2 Forms
Form 1 is main form
Form 2 is a second form,
Try1
I add Macro on form 2 on close requery form 1, not working
Try2
Form 2 on close run Stand Alone macro to requery form 1, not working
Try3
I think SetTempVar is the solutionو How can I let SetTempVar to run rquerry command at form 1?
Form 1 I create a button on click I put SetTempVar Name: Req
I create submacro to Requery
and then in Form 2 on close I use TempVar!Req but it dose not fire the macro :(

plz help 🙏
 
if you can share a sample db of what these two forms do.
 
In VBA this would simply be in the After Update event of the subform. Can you try to create a macro for the after update and reference the main form requery there? We cannot help you with specifics since you provided none for us to work with.

From Microsoft help on requery macro action.

"If you want to requery a control that isn't on the active object, you must use the Requery method in a Visual Basic for Applications (VBA) module, not the Requery macro action or its corresponding Requery method of the DoCmd object."
 
Last edited:
if you can share a sample db of what these two forms do.
Thanks for replying !
After i added new order from NewOrderF and then click on close button Requery OrderF by useing SetTempVar
plz find the Sample
🙏
 

Attachments

In VBA this would simply be in the After Update event of the subform. Can you try to create a macro for the after update and reference the main form requery there? We cannot help you with specifics since you provided none for us to work with.

From Microsoft help on requery macro action.

"If you want to requery a control that isn't on the active object, you must use the Requery method in a Visual Basic for Applications (VBA) module, not the Requery macro action or its corresponding Requery method of the DoCmd object."
Thanks for replying plz find the attached Sample I posted it
 
Sarah, I have no idea what you are trying to do in your sample DB. The OrdersF has a record source of OrdersQ which is essentially a select of the entire OrdersT table. You're other form NewOrderF has a record source of OrdersT. Since both forms have the same record source it is totally unclear what you are doing with this. Having an OrdersT table suggests that you have some product or service for customers to order. You're tables have to be established first before generating any forms. I suggest you get that worked out with some sample data before doing any forms. If you don't already know about normalization of data into separate tables, you should learn that first.
 
Sarah,
How about telling us about the "business" this data base is suppose to support. You can give us the 30,000 ft version so we have some context in order to offer focused responses.
As was requested earlier - a sample database with instructions to highlight the issue would be helpful.
 
Thanks for replying
I mean I want SetTempVar to fire a macro in other form how can i do it?
 
Thanks for replying
I mean I want SetTempVar to fire a macro in other form how can i do it?
VBA has a CallByName() function, not sure if macros have an equivalent.
 
Thanks for replying
Can SetTempVar refer to Submacro and then Submacro Fire a Embadded Macro or Stand alone Macro? If yes how 🙏
 
Thanks for replying
Can SetTempVar refer to Submacro and then Submacro Fire a Embadded Macro or Stand alone Macro? If yes how 🙏
TempVars are just global variables. They can only store values. They can't execute code/macro by themselves.
 
I mean I want SetTempVar to fire a macro in other form how can i do it?
This is not the mile high view of what you are actually trying to do that was requested by Jdraw. Setting a tempvar is just that, you set it to a value. This does nothing to trigger a macro in the other form (theDBguy beat me to that point). Could you please describe in English and not in code what you are really trying to do, then it will be more likely to get usable help. Otherwise, this will turn into a 50 post thread just trying to figure out what your overall goal is.

The problem I see with your example DB is that there is no table structure to support orders of any kind yet. You only have UsersT and OrdersT. If you really have orders, then you will need a few more tables minimum before you could even think about creating any forms. Are the people in the UsersT the customers that are ordering something? In order to order something, you need a product or service table and usually there would be a join table like OrderProductT or similar. If you have more of your table structure present in your example, things will be easier to help you with the forms.
 
Thanks for replying
I have a form on close I want Macro Action to trigger Embadded macro or Stand alone Macro for other Form
Macro trigger other Macro in other place
I am sorry 😞 I am trying hard to explain as much as I can
Thank you for your patience!
 
Last edited:
Thanks for replying
I have a form on close I want Macro Action to trigger Embadded macro or Stand alone Macro for other Form
Macro trigger other Macro
I am sorry 😞 I am trying hard to explain as much as I can
Thank you for your patience!
Probably easier to use a named (stand alone) macro. Don't think you can execute an embedded macro externally.
 
Thanks for replying
So how can I let the macro to trigger stand alone Macro on other form?
If I close the form I want stand alone Macro that belong to other form to be triggered?
 
Thanks for replying
So how can I let the macro to trigger stand alone Macro on other form?
If I close the form I want stand alone Macro that belong to other form to be triggered?
Hi. Stand alone (named) macros don't belong to any form. So, you should be able to simply call them from anywhere by using the RunMacro action.
 
see if this is what you meant.
see the macro on the button and also on the AfterUpdate event of the form.
 

Attachments

Users who are viewing this thread

Back
Top Bottom