Copying one record from one form to another

  • Thread starter Thread starter alegria4ever
  • Start date Start date
A

alegria4ever

Here's my problem:

I have a tab control page that contains 2 forms. The first form
contains order information and the second form contains the product
information. The OrderNo is the primary key in the first form and
foreign key in the second form. I have a button on the first form that
will take the user to the second form when they have finished entering
in all the order data. What I need is to transfer the OrderNo to the
second form. The OrderNo on the first form is a text box but the
second form is a combo box (choices are based on the entry first form).
I hope I'm making myself clear.

I don't know what is the best way to approached this. Please help...
 
In the button click on the first form, requery the seond form's combobox and
then set it's value before setting focus.

Forms!frmSecondForm!cboOrderNumbers.Requery
Forms!frmSecondForm!cboOrderNumbers = Me.txtOrderNumber

HTH,
Barry
 
Barry said:
In the button click on the first form, requery the seond form's combobox and
then set it's value before setting focus.

Forms!frmSecondForm!cboOrderNumbers.Requery
Forms!frmSecondForm!cboOrderNumbers = Me.txtOrderNumber

HTH,
Barry

Hi Barry,

Thanks for your help. But I got an error message when I tried to run
the following code:
******************
Private Sub cmdMove_Click()

Forms!frmProduct!cboOrderNo.Requery
Forms!frmProduct!cboOrderNo = Me.txtOrderNo
DoCmd.GoToControl ("pgProduct") 'pgProduct is where the control page
that the Product form is housed

End Sub
******************

Error Message:
Run-time error '2450':
Microsoft Access can't find the form
'frmOrder' referred to in a macro expression or Visual Basic code.
********************

I am sure the spelling of my form is correct.
 
Made a typo: Reposting previous reply

Hi Barry,

Thanks for your help. But I got an error message when I tried to run
the following code:
******************
Private Sub cmdMove_Click()


Forms!frmProduct!cboOrderNo.Requery
Forms!frmProduct!cboOrderNo = Me.txtOrderNo
DoCmd.GoToControl ("pgProduct") 'pgProduct is where the control page
that the Product form is housed


End Sub
******************


Error Message:
Run-time error '2450':
Microsoft Access can't find the form
'frmProduct' referred to in a macro expression or Visual Basic code.
********************


I am sure the spelling of my form is correct.
 
Back
Top