What is the solution to this primery key error?

cody_learn

New member
Local time
Today, 15:45
Joined
Jun 8, 2016
Messages
7
What is the sosution to get the primery key work working? As far as i can see they are identical so what is cousing the error?
dfLeDx.jpg
en
ouQq8E.jpg
 
Does the table causing the error have data in it already? Does at least one of those records have a null bestlnr field?
 
When are you getting this error?

I don't think using a Double type is a good idea for a key. I suggest changing the type to Long. If besteinr has to be a double then I suggest using an autonumber for your primary key.
 
Thx. Follow the advise.
Now i need to know how i automate the price when the ordertabel is submited, insted off manual input.

This are my tabels and relationships.
What do i change in the database to make this work?



eiHRn3.jpg


GE6a0D.jpg


UoJngs.jpg

cI7qdr.jpg


giBubN.jpg

duiU2y.jpg
 
You need to take a few steps back and fix your relationships. I don't know if I am the best to help with this because I don't speak a word of whatever language you do, so the specific tables and field names are beyond my comprehension.

However, you have made a very big error that I can identify even without knowing the language--you have circular relationships among your tables. When you establish your relationships there should only be one way to draw a path between tables, you've created multiple paths. For example, I can get draw 4 paths from bestelling to product--there should only be 1 way to do that.

Again, not a speaker of your language so I can only spot very glaring errors and that is one of them. Perhaps you have more. But right now you need to focus on fixing your tables and not this issue you posted about because most likely it is just a symptom of this larger problem.
 
Cody,

You should search the forum for posts related to Customers and Orders to see what others have experienced.
Here is a free data model that may help.
 
To calculate the total amount you would probably use DSum. I could be more specific if you tell me what the totaalbedrag is in terms of the fields in the tables.


Why do you have prijs in two tables? That doesn't look right. Also separating data into different tables with one-to-one relationships are hardly ever necessary and can cause a lot of grief. I'd consider putting the data in these cases in the same table.
 
I have translated the database into English: to get the database working.

A database is ready for download via (Dropbox) goo.gl/KI3aQs


@plog: To be more specific the totaalbedrag means; the total sales amount per ordernumber (bestelnr)


@sneuberg/@jdraw:
Good advise; Dsum and to remove the redundant information 'prijs' in the table see below
 
bestelregel (orderrule table)
bestelnr = ordernr
productnr = productnr
aantal = number
prijs = prijs
persnr = staff_number
bestelling (order table)
bestelling = bestelnr
tafelnr = table number
besteltijd = ordertime
medewerkernr = employeenumber
totaalbedrag = total ammount
tijdafrekenen = paytime
betaaldatum = payment date
Medewerker ( employee table)
voornaam = surname
achternaam = lastname
geslacht = sex
geboortedatum = date of birth
adres = adres
postcode
woonplaats = residence
functie = function
gast (guest table )
gast_achternaam = guest_surname
gast_woonplaats = guest_ residence
gast_tel = guest_telephone
gast_email = guest_surname
gast_postcode = guest_postcode
reservation (table)
resnr = reservation number
tablenr = table number
aankomstdag = arrivaldate
aankomsttijd = arrivaltime
toegewezen_tafel = assigned_table
aantalgasten = guests number
persnr = staff number
gast_tel = guest telnr


productprijs ( productprice table)
productnr = productnr
begindatum_prijs = startdate_price
einddatum_prijs = enddate_price
statusprijs = ‘ ’
prijs = price
product ( productprice table)
productnr = productnr
productomschrijving = startdate_price
soortproduct = enddate_price
btwcode = price
alcaholperc = alcohol %
 
cody,
Many will not retrieve posts from "outside" sources. Better to zip and attach to your post in the forum.
 

Users who are viewing this thread

Back
Top Bottom