Addition of fields in tables

judeastone

Registered User.
Local time
Today, 02:52
Joined
Apr 2, 2003
Messages
16
hello there

i am building a database which has computer components in different tables, such as "Motherboard" "Processor" etc, with a product code (unique key), a few description fields and a price field.

i've managed to make a form, through the wizard thing, and i think i need a macro/button thing at the bottom so when the user has entered details, it goes through a query? which does addition on those fields (i think i've half done that seperately) and will then return the complete price of the PC they've chosen, and the bits they chose on screen...

it will in future go on to store these, be able to print... ammend etc...

but i've only started using access recently and its going a bit above my head! i can program limited amouts in VBA too...

any help'd be fantastic... even just a pointer elsewhere...

thanks!!

jude
 
You don't need a macro or vba, nor should you store the total price.
Use a query to calculate the price, you can base your form/report on the query
 
Ah, thankyou very much...

One more question...

on my expression i am doing a lot of addition, and i think i have the syntax a little wrong...

Expr2: [camera.price]+[case.price]+[cooler.price]+[graphics.price]+[keyboard.price]+[memory.price]+[microphone.price]+[modem.price]+[monitor.price]+[motherboard.price]+[mouse.price]+[network.price]+[other.price]+[printer.price]+[processor.price]+[scanner.price]+[sound.price]+[speakers.price]

When i try and open it, i get the error:

"invalid bracketing of name '[camera.price]'."

if i remove camera, it gives error on case... i can't seem to see how to do the syntax from help...

thanks :o)

jude
 
[camera.price]
[case.price]
[cooler.price]
[graphics.price]
[keyboard.price]
[memory.price]
[microphone.price]
[modem.price]
[monitor.price]
[motherboard.price]
[mouse.price]
[network.price]
[other.price]
[printer.price]
[processor.price]
[scanner.price]
[sound.price]
[speakers.price]

What do all these refer to? Fields? Controls?
 
sorry about the repeat post... i realised it was off topic now, so moved it to a more relevant group...

i have individual tables called motherboard, processor, camera, case....... which are then all bought into a customer table using lookups

the scripting should then take the price field of these individual tables (key, description 1, description 2 and price) and do the maths on it...

is this the correct way of doing it?

Thanks

jude
 
Expr2: [camera].[price]+[case].[price]+[cooler].[price]+[graphics].[price]+[keyboard].[price]+[memory].[price]+[microphone].[price]+[modem].[price]+[monitor].[price]+[motherboard].[price]+[mouse].[price]+[network].[price]+[other].[price]+[printer].[price]+[processor].[price]+[scanner].[price]+[sound].[price]+[speakers].[price]
 
judeastone said:
is this the correct way of doing it?

Absolutley not !

:confused: Mile, Rich, i'm surprised none of you recommended normalising the db.

judeastone

You need to start again

You do not need a table for each component.
That is asking for trouble!

You basically need a table for the PC system and a related table to STORE all the components.

You create a 'one to many' relationship between the two.

Do a search on the forum for normalise, normalising normalize or normalizing (z):rolleyes: for more details
 
this pops up an input box each time asking for the value of each..

Enter paramater value
Camera.price
[..............]

for each one. it doesn't seem to be pulling the data from my customer table.

argh, this is irritating me now!!

any ideas?

thanks

jude
 
Mmm, well I never took any further part in the discussion so I can't be held responsible for non compliance.
The initial post did not have sufficient detail to make an informed judgement, however in simple terms three tables are required.
TblComponent a look up table which defines the type of equipment
TblEquipment which lists the individual components and their prices/descriptions etc
TblComputer
which lists the equipment per computer
 
Sorry Rich, I realised that after I posted :o
 
I agree with the comments about normalising.

But I would also observe that if the sytax was right in the expression it would have failed anyway, since at least one of these fields would be normally be null.
 

Users who are viewing this thread

Back
Top Bottom