WhereCondition newrecord

G

Guest

I have a main form with successive pop-up forms opened by command buttons
that use the docmd.openform command with the Wherecondition set to "[MainID]
= me.mainID".
Each of the pop-up forms opens correctly if there is an existing record.
However, if the child table doesn't have a record yet, how can I ?
A) check to see if there is a record (newrecord isn't set to yes when the
blank form is opened)
and
B) set the hidden textbox containing the Key [mainID] to the value of the
parent

Cheers,

Gordzilla
 
R

Rick Brandt

Gordzilla said:
I have a main form with successive pop-up forms opened by command
buttons that use the docmd.openform command with the Wherecondition
set to "[MainID] = me.mainID".
Each of the pop-up forms opens correctly if there is an existing
record. However, if the child table doesn't have a record yet, how
can I ?
A) check to see if there is a record (newrecord isn't set to yes when
the blank form is opened)
and
B) set the hidden textbox containing the Key [mainID] to the value of
the parent

Cheers,

Gordzilla

If the pop-up forms will only be used when the main form is opened just set
the default value property to something like...

=Forms!MainFormName!mainID
 
G

Guest

Thanks
That worked. I originally had that but was getting a runtime error whenever
I tried to save the record.
Turns out I had a text box on one of the forms that was bound to a field
that it shouldn't have been.

Gordzilla

Rick Brandt said:
Gordzilla said:
I have a main form with successive pop-up forms opened by command
buttons that use the docmd.openform command with the Wherecondition
set to "[MainID] = me.mainID".
Each of the pop-up forms opens correctly if there is an existing
record. However, if the child table doesn't have a record yet, how
can I ?
A) check to see if there is a record (newrecord isn't set to yes when
the blank form is opened)
and
B) set the hidden textbox containing the Key [mainID] to the value of
the parent

Cheers,

Gordzilla

If the pop-up forms will only be used when the main form is opened just set
the default value property to something like...

=Forms!MainFormName!mainID
 

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