Not able to edit order form

hrdpgajjar

Registered User.
Local time
Today, 11:20
Joined
Sep 24, 2019
Messages
97
Hi all,
I have created a customer order entry system, I have tried to follow an online tutorial and make the attached access order entry system.

Now I need help on,

1. How to create a new customer and enter order items
2. how to edit items in OrderF (it shows an error)



Thanks
 

Attachments

You should consider downloading the new Northwinds Access template. There are two versions. You should probably consider the Starter edition
1734804477073.png
 
Do NOT name your autonumbers "ID". it just causes confusion and makes it hard for others to see how the tables relate. Name this field CustomerID and USE it as the PK or do not include an autonumber at all.

Order and Order details must be related on OrderID. REMOVE RegNo from OrderDetails and replace with OrderID. Then fix the master/child links.
 
Hi all,
I have created a customer order entry system, I have tried to follow an online tutorial and make the attached access order entry system.

Now I need help on,

1. How to create a new customer and enter order items
2. how to edit items in OrderF (it shows an error)



Thanks
Hi
Your CustomerT table has a field called "ID" and is an Autonumerber but you have not set this as the PK?
The "ID" field should be renamed to CustomerID

You should then add a new field named "CustomerID" to the table "OrderT" and this should be a Number data Type - Long Integer.

You should then link the CustomerID Pk from CustomerT to the CustomerID Fk in the "OrderT" and Enforce Referential Integrity.

You can still keep your field named "RegiNo".

Also you should remove all spaces in field names.

You do not need the field "RegiNo" in both the tables "OrderT" & "OrderdetailT".

You do not need the field named "Productname" in "OrderDetailT".
 
Although I would NOT use RegNo as the PK, I would use an autonumber named CustomerID, there is no logical problem with using RegNo as the PK for Order. The problem lies between Order and OrderDetails. OrderDetails MUST relate to Order on OrderID, NOT on RegNo. As you can see, the same RegNo can place MULTIPLE orders but a single OrderDetail CANNOT point to multiple Orders. This is the logic problem the OP is experiencing.

Naming FK's by replacing ID with FK or suffixing FK is OK but not necessary. I always use the same name because both fields are never selected in the same query. When your query joins two tables, you ALWAYS take the FK value and never take the PK value.
 
Naming FK's by replacing ID with FK or suffixing FK is OK but not necessary
Agree not necessary (as indeed using relevant names is not necessary) but these days, most of my queries I write directly in sql so using PK/FK obviates the need to specify the table name (unless there are multiple child tables) so save typing. Further it tells me which end of a join each field is - not so important for inner joins but much more relevant for left/right joins, subqueries and aliased queries.

At the end of the day, particularly within an access environment, it comes down to personal style since usually the only person reading and needing to understanding it is the author. So long as they can make sense of it months down the line, it doesn't really matter
 

Users who are viewing this thread

Back
Top Bottom