Passing value from subform to new form.

TheEditor

New member
Local time
Today, 16:53
Joined
May 25, 2011
Messages
5
I'm sure this is very easy but I'm stuck. Not much of an access user i'll admit but needed it for this project.

Simple asset tracking system. 2 tables. tblClientGeneral, and tblAssetTag
Linked by Client_Id.

Main form frmClientGeneral displays the Client_Id and the Client_Name with a subform frmAssetTag that shows all assets that go with that client. Works fine.

Command button to open frmAddNewAsset. Form is set to allow data entry. Linked to the tblAssetTag table. What is not happening is it's not pulling over the client_id. Therefore the asset is essentially going to no one.

on frmAddNewAsset how to I populate the Client_id there from the selected Client_Id from the frmAssetTag that it's being opened from.

Hope that makes sense.

Thank you
Bruce
 
Try:

DoCmd.OpenForm "frmAddNewAsset"
Forms!frmAddNewAsset.Client_ID = Me.Client_ID

adjusting the names as appropriate.
 
If I've followed your scenario correctly, in the calling form (frmAssetTag)
Code:
Private Sub Go2DataEntryForm_Click()

If Not IsNull(Me.Client_ID) Then
  DoCmd.OpenForm " frmAddNewAsset ", , , , , , Me.Client_ID
Else
  MsgBox "A Client ID Must Be Entered First!"
End If

End Sub

replacing Go2DataEntryForm with the actual name of your Command Button that opens frmAddNewAsset

In the called form, frmAddNewAsset
Code:
Private Sub Form_Load()

If Not IsNull(Me.OpenArgs) Then
   DoCmd.GoToRecord , , acNewRec
   Me.Client_ID = Me.OpenArgs
 End If

End Sub
Linq ;0)>
 
Whoever's method you used was glad to help. :p
 

Users who are viewing this thread

Back
Top Bottom