dbTalk Databases Forums  

Re: Enter data in a dynaset

comp.databases.ms-access comp.databases.ms-access


Discuss Re: Enter data in a dynaset in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
russ
 
Posts: n/a

Default Re: Enter data in a dynaset - 07-28-2003 , 10:15 PM






Georges,

I'm assuming both ID numbers in these Tables are the Primary Keys and
Referential Integrity Is Enforced on CarID

I'm assuming also something like this;

"SELECT Brand, Price, Extra
FROM tblCars INNER JOIN tblExtras ON tblCars.CarID = tblExtras.CarID"

If you are attempting to enter data in this Query, you are tring
simultaneously trying to add new rows to both Tables. What you want
to do is add the car and it's price once, then add multiple extras.

The simplest answer to this question is to keep these separate. Try
opening up tblExtras in design view, click the CarID Field, then
select the Lookup Tab, choose Combo Box under Display Control,
Table/Query as Row Source Type, "SELECT CarID, Brand FROM tblCars
ORDER BY Brand" as Row Source,Bound Column = 1 and Column Count = 2
(there is a better way to display the data, but I can't quite think of
it right now)

Now just enter data directly into tblExtras or create a Form with both
Tables displayed to enter data as you wish

HTH
russ

Reply With Quote
  #2  
Old   
Mike MacSween
 
Posts: n/a

Default Re: Enter data in a dynaset - 07-28-2003 , 11:38 PM






Though of course ExtraPrice might end up in the junction table.

"Mike MacSween" <mike.macsween.damnthespam (AT) btinternet (DOT) com> wrote

Quote:
Actually, isn't it a many to many Albert?

(hint, all these examples from real life folks)

tblCar:
CarID (PK)
Make (VW, Ford etc.)
Model (Transporter Van, Scorpio Estate etc.

tblExtra:
ExtraID (PK)
Extra (KnackeredAutoShift, Duff Suspension Wishbones, Out of balance prop
shaft - you're getting the idea now?)
ExtraPrice

trelCarExtra:
CarID
ExtraID
unique index on those.

"Albert D. Kallal" <kallal (AT) msn (DOT) com> wrote in message
newsWiVa.574142$Vi5.14265123 (AT) news1 (DOT) calgary.shaw.ca...
first, you don't enter data into a query. You build a nice form that
your
users can use. Can you imagine if products like Outlook, or quicken just
let
users edit the table! There is no control, no user friendliness and
certainly letting users edit tables is a formula for disaster.

So, you would normally build a form.

As have your design, you have tblCars. So you can enter the brand, the
price, and maybe you will add some fields like date sold, and the colour
etc.

That is your ONE record. Now, you also have a Extras table, that is your
many side,and that would be a sub form.

Brand: Ford Price: 20,000
Color: Red SoldBy: Joe:

now, if you have a "many side", then extras would be a sub form, and you
would only need to display one field:
Extras:
Moon Roof
Floor mats
Crome mags


So, as you design is now, you have a one to many, and thus each extra as
designed can not have a price. If you need to have a price for each
extra,
then obviously the "price" belongs in the extra table. So, if we add a
ExtraPrice field, we could then have price for each extra. Thus, the
total
cost of the car would be each ExtraPrice + the exiting base Price.

So, you can't enter Price for each Extras with your current design,
since
you have "price" on the "one" side of the one to many relation. If you
need
a price for each extra, then add a extra price field to the Extras
table.

--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
kallal (AT) msn (DOT) com
http://www.attcanada.net/~kallal.msn







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.