Help to populate value from Main form to sub form (1 Viewer)

lookforsmt

Registered User.
Local time
Today, 18:47
Joined
Dec 26, 2011
Messages
672
HI!
i have Main form which has subfrmProduct_2_ and another frm_SOL attached to it.
i want the user to update subfrmProduct_2 by looking into the form, " frm_SOL" for the related value.

i am the below code on afterupdate on subfrmProduct_2, but i am getting error
Code:
Private Sub SOLid_AfterUpdate()
Select Case Me.SOLid
    Case 1
    Me.IDSRef = Me.Parent.SOL_ID
End Select
End Sub

Any suggestions why i am getting this error
thanks
 

Ranman256

Well-known member
Local time
Today, 10:47
Joined
Apr 9, 2015
Messages
4,339
You don't need any code,
Put the field in the subForm link propertY ,then it will add it automatically.
 

lookforsmt

Registered User.
Local time
Today, 18:47
Joined
Dec 26, 2011
Messages
672
Thanks Ranman for your response. probably i have not explained correctly, how can i copy the data from frm_SOL to subform when i select the required SOL_ID
i have updated my db for better understanding
 

Attachments

  • SelectTest_2.mdb
    344 KB · Views: 53

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:47
Joined
May 7, 2009
Messages
19,230
you test this
 

Attachments

  • SelectTest_2.zip
    34.5 KB · Views: 60

lookforsmt

Registered User.
Local time
Today, 18:47
Joined
Dec 26, 2011
Messages
672
Thanks arnelgp, for your response. How are you and hope all safe and sound around you.

With the code given by you, i will have to add select code for every new SOLid, currently there are less than 10, but soon there will be approx 50+.
Can i request for dynamic code which looks into the table for the matching details. I have tried to use dlookup but its captures the 1st SOL only.

Code:
Private Sub SOLid_AfterUpdate()
    Me.IDSRef.Value = DLookup("IDS_Ref", "tbl_SOL", "SOLid")
End Sub
 

lookforsmt

Registered User.
Local time
Today, 18:47
Joined
Dec 26, 2011
Messages
672
just one correction, it should display the IDS Ref from the matching SOL Id
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:47
Joined
May 7, 2009
Messages
19,230
Im not on pc.
What is the rowsource of the combo again.
Maybe you can Include the ID ref to your combo using Join.
 

lookforsmt

Registered User.
Local time
Today, 18:47
Joined
Dec 26, 2011
Messages
672
Sorry arnelgp, unable to do as you mentioned. If you may pls look into this once you are near your PC pls
 

lookforsmt

Registered User.
Local time
Today, 18:47
Joined
Dec 26, 2011
Messages
672
HI! arnelgp,

i tried the below code and it gave me the required solution.
Code:
    Me.IDSRef = DLookup("IDS_Ref", "tbl_SOL", "SOL_id = " & "SOLid")

thank you for your help, take care and god bless
 

Attachments

  • SelectTest_2_a.mdb
    340 KB · Views: 60

Users who are viewing this thread

Top Bottom