Copying data from one subform to another (1 Viewer)

fmm

Registered User.
Local time
Today, 00:08
Joined
Mar 15, 2001
Messages
76
I am having trouble copying data from one subform to another (Access 2000). Here's the setup:

The subform frmPurchaseSubform has a field called SerialNumber.

The subform frmSale Subform has fields Transfer Name and Transfer Serial Number.

After I enter data in Transfer Name, I need the SerialNumber from the first subform copied to Transfer Serial Number on the second.

Here's the code I'm using:
Private Sub Transfer_Name_AfterUpdate()
Me.Transfer_Serial_Number = Forms![frmPurchaseSubform]![SerialNumber]
End Sub

When I run this I get the following error message:
Run time error '2450':
Microsoft Access can't find the form 'frmPurchaseSubform' referred to in a macro expression or Visual Basic Code.

I've had 2 other people check my spelling, the form names are identical.

Any help would be appreciated.


[This message has been edited by fmm (edited 03-21-2001).]

[This message has been edited by fmm (edited 03-21-2001).]
 

Rich@ITTC

Registered User.
Local time
Today, 06:08
Joined
Jul 13, 2000
Messages
237
Hi fmm

Is the subform - Forms![frmPurchaseSubform]![SerialNumber] - open at the time you open the second form?

Also check that the actual text box isn't also called SerialNumber (the field from your query should be called SerialNumber, the text box displaying it should be called txtSerialNumber - otherwise there is a conflict).


You also usually have to reference via the main form to the subform e.g

Forms!frmMyMainForm!frmMySubform.Form!txtSerialNumber

HTH

Rich Gorvin

[This message has been edited by Rich@ITTC (edited 03-21-2001).]
 

fmm

Registered User.
Local time
Today, 00:08
Joined
Mar 15, 2001
Messages
76
Thanks, Rich.

It was referencing the main form that fixed it.
 

Users who are viewing this thread

Top Bottom