Open Subform - GoToRecord = Current Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created a subform using the wizard in the main form. I have a command
button to open this subform (pop-up window) and would like it to open to the
same record number (or the same "Key" which is the field "ID") in the subform
as is open in the main form. Right now the command code is defaulting to the
"Next" record but then the data I enter into the subform is going to the next
record, not the current record for which the data is for. Would you please
advise me on how to link the form and subform records?

The desired outcome is not exactly what subforms are made for. I'm using the
subform as a pop-up window with yes/no data fields to save space on the main
form. I actually have the subform fields referencing the main table. This is
because of the problem of drop downs not allowing you to select more than one
answer and when you use a list which does allow it, you get annoying text
fields that are hard to analyze/query later on. But if you have a more
economical suggestion to achieving this I'm all ears. =)

Thank you,
Carrie
 
I created a subform using the wizard in the main form. I have
a command button to open this subform (pop-up window) and
would like it to open to the same record number (or the same
"Key" which is the field "ID") in the subform as is open in
the main form. Right now the command code is defaulting to the
"Next" record but then the data I enter into the subform is
going to the next record, not the current record for which the
data is for. Would you please advise me on how to link the
form and subform records?
Did you set up the button using the wizard too?

If I understand correctly, you actually do not have a subform,
you have a popup form. Did you delete the subform control on the
mainform that the wizard created?

The desired outcome is not exactly what subforms are made for.
I'm using the subform as a pop-up window with yes/no data
fields to save space on the main form. I actually have the
subform fields referencing the main table. This is because of
the problem of drop downs not allowing you to select more than
one answer and when you use a list which does allow it, you
get annoying text fields that are hard to analyze/query later
on. But if you have a more economical suggestion to achieving
this I'm all ears. =)

I'd use a tabbed form with the info you want all the time above
the tab control which has groups of related fields. In my
employees form the upper section holds the txt_emp_name,
date_emp_hired textboxes. one tab holds the home address and
phone, another the office location, a third the position info
and a fourth the employee's history which is a true subform of a
related table.
Thank you,
Carrie
 
Thanks Bob. You are correct, I have pop-up forms, not subforms although I
could create them with the wizard just the same. Thank you for your
suggestion to use tabs, but I'd really like to have the sections hidden
(something you can't do with tabs) and then open them only if another control
is selected.

Is there any way to link the records between the main form and the pop-up
forms? For example, when you have open record #101 in the main form you
automatically open record #101 when the pop-up form opens?

Thanks so much for all your help, I've gotten some great tips from other
posts as well.
~ Carrie
 
Thanks Bob. You are correct, I have pop-up forms, not subforms
although I could create them with the wizard just the same.
Thank you for your suggestion to use tabs, but I'd really like
to have the sections hidden (something you can't do with tabs)
and then open them only if another control is selected.

Is there any way to link the records between the main form and
the pop-up forms? For example, when you have open record #101
in the main form you automatically open record #101 when the
pop-up form opens?

Thanks so much for all your help, I've gotten some great tips
from other posts as well.
~ Carrie
You can open the popup form to the correct record by passing the
correct key for the record in the docmd.openform method.
However, unless you take special care in coding the application,
in saving the first form's data before opening the second, you
will get "record locked by another user messages", even if you
are the "other user". Worse if the record in the main form is
new, there is no record to go to in the popup form.

I've passed a single control(a memo field) to a popup form by
leaving the subform unbound and referring to the main form's
hidden textbox bound to that memo field.



Bob Quintal said:
Did you set up the button using the wizard too?

If I understand correctly, you actually do not have a
subform, you have a popup form. Did you delete the subform
control on the mainform that the wizard created?



I'd use a tabbed form with the info you want all the time
above the tab control which has groups of related fields. In
my employees form the upper section holds the txt_emp_name,
date_emp_hired textboxes. one tab holds the home address and
phone, another the office location, a third the position info
and a fourth the employee's history which is a true subform
of a related table.
 
Back
Top