how to setfocus to a button on the subform and execute what's underneath that button?

Ugurovic

Registered User.
Local time
Today, 03:01
Joined
Aug 22, 2008
Messages
36
Hello

I think the title explains a lot.

1. How to refer from mainform-button to subform-button AND execute whats underneath that button? Setfocus->Execute.
Button on subform will be 'unvisiable'.

Thanks in advance

Ugurovic
 
You could try calling the code of the hidden button.

Call Me.subformname.Form.mybutton_Click
 
THanks for your reply.

But it doesn't work. You can only refer to events of the subform and not what's in the form.
What expression does refer to a button on the subform?

Kind regards

Ugurovic
 
But surely that is what you are trying to do.

'Execute the event of a button that is in a subform but not visible.'

or have I mist the question?
 
why is the button on the subform invisible?

either
a) make the subform button visible or
b) make the parent button do whatever the subform button was going to do
 
I want to undo changes made to the subform.

I think it also works with .Edit.
But is it possible that I make my Mainform Bounded to the table and write edited unbounded fields of the subform by .Edit, currentdb...
I don't know the exact code to write unbounded fiels of a form to a table. Maybe you can post that with a little explanation?

Kind regards.

Ugurovic
 
Hello

I think the title explains a lot.

1. How to refer from mainform-button to subform-button AND execute whats underneath that button? Setfocus->Execute.
Button on subform will be 'unvisiable'.

Thanks in advance

Ugurovic
I don't think you can move the focus to an object that is invisible.

As for executing the code just move the code from the Click event of the button and put it in a general VBA module as a sub or a function. Then you will be able to call it from anywhere in your DB.
 
Ok.

Is there any possible way to undo changes on a subform not using unbound fields AND the escape button? If not, I'm gonna kill myself.


Regards

Ugurovic
 
Not sure if this is going to help you but try putting this into the event of the button on your main form.

'Set focus to the subform
Me.yoursubformname.SetFocus
'Perform an undo
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
 
Thank you,

Your code is only working on the first record of the subform and not on the rest of it. Is it because I use continous forms, I think so. Is there a possibility to perform a loop of all the records of the subform...??

Regards

Ugurovic
 
Can you post your db on here, it will make it easier to find out what works and what doesnt.
 
Hello

I attached my DB, without some data and other forms.
With the "NEW" button, I make a new record.
With "MODIFY" button I want to make changes to subform and mainform. But when I press close, I want that the changes made to be cancelled and the records returns to his previous version.

Hope it works, counting on you guys/girls...

Kind regards

Ugurovic
 

Attachments

Users who are viewing this thread

Back
Top Bottom