Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / November 2007

Tip: Looking for answers? Try searching our database.

Query of three fields simultaneously

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
acores - 04 Nov 2007 21:57 GMT
Hello. Can anyone help with this problem, please?

I am building a library database and I created the table «tbl_keywords».
This table has only one field named «Keywords» and I inserted some records on
this table such as «Fictional», «Romance» and «Technical», for example.

I inserted three combo boxes in the book form «frm_book» to allow the user
to choose the keywords associated to each book. The user can choose up to
three keywords of the table «tbl_keywords» for each book (one on each combo
box). Each keyword chosen is saved on the books record, as «kw1», «kw2» and
«kw3».

Everything is working fine, until this: I want to create a query that allows
the user to see all the books of one certain type, I mean, keyword. Imagine
that you need to see all the «Romance» books, for example. The problem is
that the query must search the keyword «Romance» in the three fields «kw1»,
«kw2» and «kw3» of the table «tbl_books», because the user could have chosen
«Romance» in one of the three combo boxes.

I hope I made myself clear, but ask me if you have any question, please.

Thanks in advance.

Best regards,

Acores
Arvin Meyer [MVP] - 04 Nov 2007 22:37 GMT
Since a book cannot be more than one type, you only need 1 combo to search
that type. Storing multiple values in a single field (regardless of whether
or not it is possible to do so) is poor database design and a violation of
database normalization rules.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> Hello. Can anyone help with this problem, please?
>
[quoted text clipped - 29 lines]
>
> Acores
acores - 05 Nov 2007 14:21 GMT
Thanks for your answer, Arvin.

But the problem is that a book can be more than one type. The example I gave
is not so happy but I tried to ilustrate the situation. Imagine for example
that you want to associate to a certain book the keywords «War», «Drama» and
«Terror». That is why I have three combo boxes in order to allow the user to
choose more than one keyword for each book. Do you understand what I mean?
(my English is not so good)

Thank you in advance for your help.

Best regards.

Acores

> Since a book cannot be more than one type, you only need 1 combo to search
> that type. Storing multiple values in a single field (regardless of whether
[quoted text clipped - 33 lines]
> >
> > Acores
Douglas J. Steele - 05 Nov 2007 14:49 GMT
The problem would appear to be that you've actually got a many-to-many
relationship between books and keywords, which means that you should be
storing each keyword as a separate row in a third table to resolve the
many-to-many.

Take a look in the Northwind database that comes with Access. The
relationship between Products and Orders is also a many-to-many (one Product
can appear on many Orders, one Order can contain many Products), so table
Order Details was created.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Thanks for your answer, Arvin.
>
[quoted text clipped - 61 lines]
>> >
>> > Acores
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.