473,498 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating Values

2 New Member
I will try to make it as concise as possible.

I got three tables

tblBrands
-------------
BrandID (PK
BrandName

(Each Brand has different series. So I created a series table)

tblSeries
-------------
SeriesID (PK)
BrandName
SeriesName


tblWatches
---------------
WatchID (PK)
BrandName (*)
SeriesName (**)

(*) populated list box with query SELECT BrandName FROM tblBrands ORDER BY BrandName - This worked fine

here where it gets tricky

(**) this column I need to only show the series under the Brand that I chose. So I use this line SELECT [Series].[SeriesName] FROM Series WHERE [Brands].[BrandName] = [Series].[BrandName];

It works in a wierd way where it opens an alert asking me to type the Brand value. But I want it to take the value of BrandName automatically from the current record.

Who can help me to solve this?

Thanks,
AC
Dec 9 '10 #1
5 1559
pod
298 Contributor
You must include all tables (Series and Brands) that are involved in your query ...
Expand|Select|Wrap|Line Numbers
  1. SELECT [Series].[SeriesName] 
  2. FROM Series, Brands
  3. WHERE [Brands].[BrandName] = [Series].[BrandName]
P:oD
Dec 9 '10 #2
mshmyob
904 Recognized Expert Contributor
Actually the first thing you should do is normalize your database.

You do not link tables by descriptive names, they should be linked via the PK/FK.

So for instance in your tables tblBrands and tblSeries you are linked via the BrandName when you should change the BrandName field in the tblSeries to BrandID and link it to the BrandID field of tblBrand.

Same goes for tblWatches - it looks to be a bridge table.

cheers,
Dec 9 '10 #3
pod
298 Contributor
@mshmyob: how gauche of me not to have mentionned the linking by the PKs...that is why I do not have a E beside my avatar ;)
Dec 9 '10 #4
mshmyob
904 Recognized Expert Contributor
What do you expect from someone from Ottawa :) now if you were from the centre of the Universe (Toronto) you would have mentioned it. (lol).

I have seen many posts from you and they are always spot on. Besides I had to pay big bucks to Neo to get that "E" :)

cheers,
Dec 9 '10 #5
Abba Cohen
2 New Member
Thanks for your quick response.

I have solved the problem.

I have created a form and synchronized the combo boxes via VBA using this code.

Expand|Select|Wrap|Line Numbers
  1. Private Sub BrandName_AfterUpdate()
  2.     Me.SeriesName.RowSource = "SELECT SeriesName FROM" & _
  3.                             " tblSeries WHERE BrandName = '" & Me.BrandName & _
  4.                             "' ORDER BY SeriesName"
  5.     Me.SeriesName = Me.SeriesName.ItemData(0)
  6. End Sub
Dec 9 '10 #6

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

Similar topics

7
4059
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
5
27059
by: - | last post by:
Hi all, I want to create an sql script and one of the table that will be created is a 'country' table. The question is how do I populate the country tables? Should there be individual INSERT...
2
3331
by: John Ninan | last post by:
I am creating Dynamic Usercontrol in Asp.net application. In this application I have a combobox(aspx Page). Which contains various items. Based on item selected I am dynamically populating...
6
5176
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I...
3
14697
by: Eric | last post by:
Im populating a combobox from query results like that below. This works great for populating the box, but I dont want the selected text, but the ID info associated with the selection. The query...
3
6024
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
0
1428
by: fedroque | last post by:
heres the scenario: i have a book and i scanned its barcode to get all the information using app A, but i need all these info, plus more to print a new barcode using a barcode software, app B. i...
13
3504
by: Mary | last post by:
I'll pulling my hair out on this one and would be so appreciative of any help. I am creating a data entry form to enter results of a student survey. There are 40 questions on the survey. The...
0
1671
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my...
5
1674
by: cmt | last post by:
I have an ASP report that returns values from a SQL database and formats the data in an HTML table. I am trying to figure out a good way of using CSS to highlight the table row that contains the...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7165
Oralloy
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,...
0
7205
jinu1996
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...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5462
agi2029
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,...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
291
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.