Connecting Tech Pros Worldwide Forums | Help | Site Map

Moving from one form to another and then back

scottallenmccullough@gmail.com
Guest
 
Posts: n/a
#1: Nov 13 '05
I'm sure there is an easy solution for this problem. On "FORM A" is a
combobox with a separate table as its record source. If the data
required in the combobox is not one of the available choices in the
underlying recod source, the user is prompted to "click" a button
opening "FORM B" allowing them to add the necessary data to the
combobox's underlying recordset. Is there a way when closing FORM B and
returning to FORM A to requery the combobox on FORM A so the data that
was just added to the underlying recordset is now one of the available
choices in the combobox?

Thanks
Scott

Rick Brandt
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Moving from one form to another and then back


scottallenmccullough@gmail.com wrote:[color=blue]
> I'm sure there is an easy solution for this problem. On "FORM A" is a
> combobox with a separate table as its record source. If the data
> required in the combobox is not one of the available choices in the
> underlying recod source, the user is prompted to "click" a button
> opening "FORM B" allowing them to add the necessary data to the
> combobox's underlying recordset. Is there a way when closing FORM B
> and returning to FORM A to requery the combobox on FORM A so the data
> that was just added to the underlying recordset is now one of the
> available choices in the combobox?
>
> Thanks
> Scott[/color]

Open FormB with the acDialog option then add a requery in the next line of
code.

DoCmd.OpenForm "FormB",,,,,acDialog
Me.ComboBoxName.Requery

The acDialog option will cause the code to pause after the OpenForm method
and will not execute the last line until FormB has been closed.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


scottallenmccullough@gmail.com
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Moving from one form to another and then back


Excellent! I knew it was something simple. Thanks for your help.

Scott

Ed Robichaud
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Moving from one form to another and then back


Sure; this is a very common setup. In the On Close property of formB, put
some code like:

Forms!formA!myCombo.Requery

This assumes that formA will always be open. If not, add error checking to
handle cases when it is not.
Your combobox on formA will now show the record you just added on formB.
-Ed


<scottallenmccullough@gmail.com> wrote in message
news:1108477146.397681.28720@f14g2000cwb.googlegro ups.com...[color=blue]
> I'm sure there is an easy solution for this problem. On "FORM A" is a
> combobox with a separate table as its record source. If the data
> required in the combobox is not one of the available choices in the
> underlying recod source, the user is prompted to "click" a button
> opening "FORM B" allowing them to add the necessary data to the
> combobox's underlying recordset. Is there a way when closing FORM B and
> returning to FORM A to requery the combobox on FORM A so the data that
> was just added to the underlying recordset is now one of the available
> choices in the combobox?
>
> Thanks
> Scott
>[/color]


Closed Thread