UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Populate Textbox With Data From Subform, Access 2016    
 
   
agent.oen
post Sep 30 2017, 04:34 AM
Post#1



Posts: 5
Joined: 25-September 17



Hi there,

I have a main form with a subform on it. The main form allows for viewing and data entry for Movies. The subform allows for viewing and data entry of the Genres for that movie. The underlying relationship used is a many-to-many. I find the subform to be unsightly on the main form. My solution to tidy up the main form is: use a TextBox with an onClick event that brings up the subform. The TextBox should show the movie genres for that movie being displayed in the form (if any were assigned yet).

I thought of the DLookUp function but realised this option allows only for 1 record to be retrieved. Since a movie may have multiple genres, this would require the possibility of multiple records from the same table to be retrieved. DLookUp would assumingly not work then.

How can I solve this issue? Below are the data required for the above problem:

Movie table: tblMovie. PK: ID_Movie
Genre table: tblGenre. PK: ID_Genre. Genres stored under the field: Genre
Link table: tblMovieGenre. Compund key: FK_Movie, FK_Genre
Main form: frmMovie
Subform: sfrmMovieGenre

I would appreciate any help in this issue!

Thanks!
This post has been edited by agent.oen: Sep 30 2017, 04:36 AM
Go to the top of the page
 
moke123
post Sep 30 2017, 06:47 AM
Post#2



Posts: 1,120
Joined: 26-December 12
From: Western Ma.,L.I.,N.Y.,Jupiter,Fl.



have you tried setting the master/child links between your form and subform?
Go to the top of the page
 
GroverParkGeorge
post Sep 30 2017, 06:51 AM
Post#3


UA Admin
Posts: 30,760
Joined: 20-June 02
From: Newcastle, WA


The main form/sub form design is the most effective and most appropriate way to do this, so my advice would be to bite the bullet and do it. It may appear to you to be "unsightly", but if it works better than any alternative....


One of the most respected Access developers in our community has offered the analogy of paddling a canoe on a swift flowing river. Paddling upstream, against the current, can be done, but it requires a lot more work than going downstream, using the current to move you and only using the paddle to keep you on course.

Main form/sub form in Access is the downstream choice.

--------------------
Go to the top of the page
 
GroverParkGeorge
post Sep 30 2017, 07:00 AM
Post#4


UA Admin
Posts: 30,760
Joined: 20-June 02
From: Newcastle, WA


In addition to the design issues, your question suggests that you may not have thought through the consequences of the alternative advanced, "Yhe TextBox should show the movie genres for that movie being displayed in the form (if any were assigned yet)." How? If it is true that a movie can be assigned to multiple genres, putting them all into a bound text box would be inappropriate, and if you make it an unbound textbox and use code to populate it for display, well, you end up writing wads of unneeded code to maintain it while manipulating the underlying junction table to get those genres.

So, in the end, what have you gained? Perhaps the visual appearance is worthwhile, but perhaps it's just a lot of work for a small gain, IMO.

--------------------
Go to the top of the page
 
projecttoday
post Sep 30 2017, 12:51 PM
Post#5


UtterAccess VIP
Posts: 8,475
Joined: 10-February 04
From: South Charleston, WV


If you don't like the appearance of the subform you can use a continuous form. You can filter a continuous form from a selection on another form.

--------------------
Robert Crouser

My company's website
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    23rd October 2017 - 09:08 PM