Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking to a subform

Status
Not open for further replies.

AGlazer

Programmer
Sep 15, 2002
38
0
0
US
Hi, everyone.

I'm in the process of setting up a form which has both a primary and subform embedded within it, linked based on a primary key of MemberID.

I also want to create a button that links to a different subform (a pop-up form). However, I need that subform to be automatically linked to the current MemberID, so that anything they enter into the new form will be related to that MemberID. How do I do this?

Thanks,

Aaron
 
To explain this I need actual names.

So lets define the table that this popup form is bound to as tblSubPopUp

tblSubPopUp has a prime Key of SupPopUpId
tblSubPopUp has a Foreign Key of MemberRef which links this table on the many end of a 1-many relationship with tblMember.MemberId

So on the form that is bound to tblMember you place the Button and also place a controlbox ( .Visible = No if you don't want the user to see it. ) Call the control box txtMemberId and bind it to field MemberId

Then in the button's On_Click event :-

DoCmd.OpenForm "frmSubPopUp",,,,"MemberRef = " & txtMemberId


The above assumes MemberId is a number
If MemberId is Text then you'll need
DoCmd.OpenForm "frmSubPopUp",,,,"MemberRef = '" & txtMemberId & "' "


Replace all my invented names with your real names and you should be flying.





'ope-that-'elps.






G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top