Running a button method in one form from a buttton method in another form

J

Jade Tippett

I sent this message to the Forms Coding newsgroup, but it
must have gone into a black hole.

I am a neophyte, trying to stretch my mind.

I am trying to program a button in a data form to open
another form, then execute a button method within that
newly opened form.

The button in the first form is a New Record method to add
a record to the second form's underlying table. The second
form's AllowAdditions property is set to "no" and has a
"Save Changes" button and a prompt text box that are
normally hidden.

I have put a "New Record" button on the second form that
opens a NewRecord form, sets the AllowAdditions to "yes"
and sets the Visible properties of the button and txtPrompt
boxes to "yes."

How do I code the button in the main form to do all these
things at once in another form? Can I execute the button
method in the second form fromt he code behind the button
in the first?

Thanks in advance for your help.

--jade

(e-mail address removed)
 
W

Wayne Morgan

The way you have this phrased, I'm a little confused. Are you speaking of a
total of 2 forms or 3?

If 2 forms, have you tried opening the second form with the acFormAdd data
mode argument to open the form in Add mode? This will override the default
settings in the form.

Example:
DoCmd.OpenForm "MyForm", , , , acFormAdd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top