I have 3 tables
Table 1: tblMovie
MovID (PK)
MovName
Table 2: tblGenre (manually inputted; limited to existing data)
GenreID (PK)
GenreName
Table 3: junction (MovID has lookup on MovName from tblMovie; GenreID has a lookup on GenreName from tblGenre)
MovID
GenreID
I would like to have a form which shows the movie title and its genre;
e.g
Title: Fictional Movie
Genre: Action, Horror, Suspense, Drama
I've tried using text box, combo box, and list box. But at most i was only able to show a Single Genre Name with mutiple record instance of the same title.
Any help on how to solve this problem is greatly appreciated
tnx.
5 1643
I have 3 tables
Table 1: tblMovie
MovID (PK)
MovName
Table 2: tblGenre (manually inputted; limited to existing data)
GenreID (PK)
GenreName
Table 3: junction (MovID has lookup on MovName from tblMovie; GenreID has a lookup on GenreName from tblGenre)
MovID
GenreID
I would like to have a form which shows the movie title and its genre;
e.g
Title: Fictional Movie
Genre: Action, Horror, Suspense, Drama
I've tried using text box, combo box, and list box. But at most i was only able to show a Single Genre Name with mutiple record instance of the same title.
Any help on how to solve this problem is greatly appreciated
tnx.
If you defined your Relationships as follows, you wouldn't need any type of Lookup: - [tblMovie].[MovID](1) ==> [Junction].[MovID](MANY)
-
[tblGenre].[GenreID](1) ==> [Junction].[GenreID](MABY)
You could then just simply create a Form/Sub-Form scenario with the Composite Key from the Junction Table as the Link.
If you defined your Relationships as follows, you wouldn't need any type of Lookup: - [tblMovie].[MovID](1) ==> [Junction].[MovID](MANY)
-
[tblGenre].[GenreID](1) ==> [Junction].[GenreID](MABY)
You could then just simply create a Form/Sub-Form scenario with the Composite Key from the Junction Table as the Link.
Thanks for the Info. Actually the sole purpose of the lookup was so that Genre and Title wouldnt show up as only numbers.
Anyways tried it as you said. but still not working. To be more elaborate. my problem is that my records on form shows up like this;
Record 1:
Title: Fictional Movie 1
Genre: Action
Record 2:
Title: Fictional Movie 1
Genre: Comedy
Record 3:
Title: Fictional Movie 2
Genre: Romance
Total of 3 records
Instead of like this:
Record 1:
Title:Fictonal Movie 1
Genre: Action, Comedy
Record 2:
Title: Fictional Movie 2
Genre: Romace
Total of 2 records
I'd like to have the Genre in a single textbox if possible, but a listbox is acceptable too. Thinking of making a loop which looks up the junction table, but have no idea no how to do it. Can anyone give a hint on how to start.
Sorry for the long post.
Thanks for the Info. Actually the sole purpose of the lookup was so that Genre and Title wouldnt show up as only numbers.
Anyways tried it as you said. but still not working. To be more elaborate. my problem is that my records on form shows up like this;
Record 1:
Title: Fictional Movie 1
Genre: Action
Record 2:
Title: Fictional Movie 1
Genre: Comedy
Record 3:
Title: Fictional Movie 2
Genre: Romance
Total of 3 records
Instead of like this:
Record 1:
Title:Fictonal Movie 1
Genre: Action, Comedy
Record 2:
Title: Fictional Movie 2
Genre: Romace
Total of 2 records
I'd like to have the Genre in a single textbox if possible, but a listbox is acceptable too. Thinking of making a loop which looks up the junction table, but have no idea no how to do it. Can anyone give a hint on how to start.
Sorry for the long post.
- Create a Form based solely on tblMovie consisting of the [MovID] and [MovName] Fields.
- Create a Query named qryMovieGenreJunction consisting of all 3 Tables joined as previously indicated.
- Assuming that a Text Box (Unbound) on frmMovies is called txtGenre, the followinig code in the Current() Event of the Form will produce the desired results.
- Private Sub Form_Current()
-
Dim MyDB As DAO.Database, MyRS As DAO.Recordset
-
Dim MySQL As String, strGenre As String
-
-
MySQL = "Select * From qryMovieGenreJunction Where [MovID]=" & Me![MovID]
-
-
Set MyDB = CurrentDb()
-
Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenDynaset)
-
-
Do Until MyRS.EOF
-
strGenre = strGenre & MyRS![GenreName] & ","
-
MyRS.MoveNext
-
Loop
-
-
strGenre = Left$(strGenre, Len(strGenre) - 1)
-
-
Me![txtGenre] = strGenre
-
-
MyRS.Close
-
End Sub
Sample OUTPUT for txtGenre Field: - Action,Comedy,Romance
-
Unknown,Weird
- Create a Form based solely on tblMovie consisting of the [MovID] and [MovName] Fields.
- Create a Query named qryMovieGenreJunction consisting of all 3 Tables joined as previously indicated.
- Assuming that a Text Box (Unbound) on frmMovies is called txtGenre, the followinig code in the Current() Event of the Form will produce the desired results.
- Private Sub Form_Current()
-
Dim MyDB As DAO.Database, MyRS As DAO.Recordset
-
Dim MySQL As String, strGenre As String
-
-
MySQL = "Select * From qryMovieGenreJunction Where [MovID]=" & Me![MovID]
-
-
Set MyDB = CurrentDb()
-
Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenDynaset)
-
-
Do Until MyRS.EOF
-
strGenre = strGenre & MyRS![GenreName] & ","
-
MyRS.MoveNext
-
Loop
-
-
strGenre = Left$(strGenre, Len(strGenre) - 1)
-
-
Me![txtGenre] = strGenre
-
-
MyRS.Close
-
End Sub
Sample OUTPUT for txtGenre Field: - Action,Comedy,Romance
-
Unknown,Weird
I'm getting a lot of errors... might just be my setting though. Gonna check it first. btw can I know what references you had checked when you did this code. I seem to get "cannot find project or library" on the dbopendynaset line even though i have DAO 3.6
I'm getting a lot of errors... might just be my setting though. Gonna check it first. btw can I know what references you had checked when you did this code. I seem to get "cannot find project or library" on the dbopendynaset line even though i have DAO 3.6
In your specifric caes, you'll need a Reference set to the Microsof DAO 3.6 Object library.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mksql |
last post by:
As an example, I am building an authentication mechanisim that will use
data in the 3 left tables to determine rights to objects in a
destination table, diagrammed below. In this structure,...
|
by: Marcy |
last post by:
I am trying to build a database to keep track of training topics completed by
people in my department. Our department has a set of 37 training topics. There
are 7 job classifications in the...
|
by: LurfysMa |
last post by:
I am working on an electronic flashcard program. Most of the subjects
are simple lists of questions and answers. Those seem to be working.
Some of the "subjects" have "categories" of questions.
...
|
by: inthemix |
last post by:
My goal is to have a sub-form located on the main form which containts a listbox. The user will be able to select anany number of offices (by officeName) from this listbox.
IMO the design is very...
|
by: que576 |
last post by:
I have created a junction table so that I can relate data from 2 other tables.
Table 1 - Category Table (has the following fields with data)
CatID (primary key)
CategoryName
CategoryStatus
...
|
by: jatrojoomla |
last post by:
Hi!
Is there any one with knowledge of CJ API
development
I am getting error like:
http://fb.aafter.com/cj/testb/support.php
during Commission Junction SOAP access
Commission Junction:...
|
by: Henry Stockbridge |
last post by:
Hi,
I need a recommendation when to add a record to a junction table that
complements a many to many relationship. There will be a Contacts
form, and an Interests subform with the parent/child...
|
by: dbertanjoli |
last post by:
Hello,
I have a questinarrie webform I use INSERT statement(s) to insert a new record in the User and Questions tables and then (HERE IS MY PROBLEM) I need to update my junction table...
|
by: pwebbie |
last post by:
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |