By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,504 Members | 1,410 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,504 IT Pros & Developers. It's quick & easy.

Subform datasheet with many-to-many junction table

P: 1
In an MS Access Project tied to SQL Server, I am trying to create a data entry form that allows the user to enter info about a law, and then (in a datasheet) edit/insert related web site records (text fields: link title, URL, and description). I have created a main form "law" (text fields in single form) with a subform "links" (text fields in a datasheet format). The "law" and "links" are associated through a junction table "lawlinks".

How can I limit the display of records in the "links" subform to only those records that apply to the "law" that is displayed in the main form? (Note that I do not have a Master/Child relationship defined, as that did not appear to work with junction tables.)

Any help is appreciated.
Oct 24 '08 #1
Share this Question
Share on Google+
1 Reply


nico5038
Expert 2.5K+
P: 3,072
You'll need the Master/Child linking,but you'll have to start with adding a linked subform for the LawLinks table. (Linking by the Law of course)

Next add to the master form a (optionally hidden) textfield txtLink.
In the OnCurrent event of the sfrmLawLinks add this code:
Expand|Select|Wrap|Line Numbers
  1. Parent.txtLawLinks = Me.Link
  2.  
Now add the subform for the LawLink additional table and manually add the Master/Child link based on the Law_ID of the masterform and the txtLink of the sfrmLawLinks. This will automatically fill the both fields in the subform when adding records.

Getting the idea ?

Nic;o)
Oct 24 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.