Copy information

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

Guest

I'm trying to create a command button that will copy information in 2 fields
simultaneously from a form to a subform. I found an example in another
database that looks like this:

Private Sub cmdEnter_Click()
[strDescr] = [Forms]![frmEqpt]![strType]
[intICN] = [Forms]![frmEqpt]![intPartNum]
End Sub

If I use this, I get an error "cannot find [frmEqpt]".
If there is a better way to do this, please help.
 
PieterZ said:
I'm trying to create a command button that will copy information in 2
fields simultaneously from a form to a subform. I found an example in
another database that looks like this:

Private Sub cmdEnter_Click()
[strDescr] = [Forms]![frmEqpt]![strType]
[intICN] = [Forms]![frmEqpt]![intPartNum]
End Sub

If I use this, I get an error "cannot find [frmEqpt]".
If there is a better way to do this, please help.

Where does this button reside? Is frmEqpt an open form when you run this code?
 
frmEqpt is a subform on the form in which the button is situated.

Rick Brandt said:
PieterZ said:
I'm trying to create a command button that will copy information in 2
fields simultaneously from a form to a subform. I found an example in
another database that looks like this:

Private Sub cmdEnter_Click()
[strDescr] = [Forms]![frmEqpt]![strType]
[intICN] = [Forms]![frmEqpt]![intPartNum]
End Sub

If I use this, I get an error "cannot find [frmEqpt]".
If there is a better way to do this, please help.

Where does this button reside? Is frmEqpt an open form when you run this code?
 
PieterZ said:
frmEqpt is a subform on the form in which the button is situated.

"Rick Brandt" wrote:

Subforms are not technically "Open" which is why your syntax doesn't work.
You need to reference it by going through the parent form and then its
subform control.

Forms!NameOfParentForm!NameOfSubformControl.Form!intPartNum
 
Back
Top