Shortskimper
Registered User.
- Local time
 - Today, 06:37
 
- Joined
 - Sep 10, 2015
 
- Messages
 - 30
 
"But there are even lookup fields in tables that refer to tables that do not exist in this DB."I checked the database:
=> In order to understand any connections, my first look goes into the relationship window. Here the view went into emptiness, which in itself is a reason to close and bury the whole thing.
=> I had overcome myself for a moment and still had a quick look at queries and tables, which is exhausting. Tables have lookup fields. This is already problematic in itself, and the reasons for this have been extensively presented in many places.
But there are even lookup fields in tables that refer to tables that do not exist in this DB.
With that, I was finally allowed to break off my attempt to understand. The move to forms would be in vain without understanding the data.
Here is the query on purpose, the form references have been replaced with realistic ID's => this makes the form uninteresting.Attempt to put more than one record in qryOrders
SELECT
   tblJobNo.JobID,
   tblReleaseNum.ReleaseID,
   tblReleaseNum.JobNumID,
   tblOrders.OrderID,
   tblOrders.ReleaseNumID,
   tblOrders.OrderBody
FROM
   (tblJobNo
      INNER JOIN tblReleaseNum
      ON tblJobNo.JobID = tblReleaseNum.JobNumID
   )
   LEFT JOIN tblOrders
   ON tblReleaseNum.ReleaseID = tblOrders.ReleaseNumID
WHERE
   tblJobNo.JobID = 2737
      AND
   tblReleaseNum.ReleaseID = 4965
	As i read. I'm having an Ephinay. I don't need the tblJobNo in this query at all. If i only had the left join from tblReleaseNum to tblOrders. Would this allow me to safely add records to tblOrders with the proper ReleaseID? I will test this. More important, is it safe?Here is the query on purpose, the form references have been replaced with realistic ID's => this makes the form uninteresting.
A query with several JOINs is not an Excel table (where you can do EVERYTHING) and in my view cannot be updated or expanded by data records. In exceptional cases, this can be successful with a first data set, but you can't work like this in the long run.SQL:SELECT tblJobNo.JobID, tblReleaseNum.ReleaseID, tblReleaseNum.JobNumID, tblOrders.OrderID, tblOrders.ReleaseNumID, tblOrders.OrderBody FROM (tblJobNo INNER JOIN tblReleaseNum ON tblJobNo.JobID = tblReleaseNum.JobNumID ) LEFT JOIN tblOrders ON tblReleaseNum.ReleaseID = tblOrders.ReleaseNumID WHERE tblJobNo.JobID = 2737 AND tblReleaseNum.ReleaseID = 4965
It is safe to practice if you make edits or new additions in exactly one table and this in a separate form. The query then only summarizes the data from the tables including changes.
Good idea. In all variants! Own experiences and pain improve the process of understanding.I will test this.
I read this Post for at least an hour. and did some experimenting. I HAVE FOUND A WAY! Between you, Doc, and ebs. I thank all of you for having the patience and saying the same thing to me 12 different ways until I was able to fully grasp / understand it!I'm sorry. That came across wrong. Many people do feel they can ask us to build things for them as if we were their employee. You did not do that. But, you did fall into the typical. I did this. It doesn't work. How do I fix it? Which we can sometimes work with but not always. I did figure out what your original problem was and I described the solution. Please review #16. Did that not fix the initial problem? You then asked why you can not add multiple rows to the form and the answer is because it is linked to a specific, single record. So I posted an example of a m-m relationship in #18. Did you examine that? Do you understand the concept of a m-m relationship?
You CANNOT add multiple records to the order because you are adding a row to the order table and the order table has a foreign key that points to ONE record. That's where I mentioned that you might need to bind the order form to the details table rather than ReleaseNum.
The typical Order entry process is a many-many relationship at its lowest level.
tblOrder is the order header and has a FK to the customer
tblOrderDetails is the table that holds the items being ordered. Items NEVER go in the order header table which is what you seem to be doing. tblOrderDetails has two foreign keys. One to its parent table - tblOrder and a second to tblProduct which is the item being ordered. tblOrderDetails is the junction table that connects an order with many items. An order can contain many products and a product can be on many orders = many-many.
You don't have a many-many relationship that I can identify. I know the sample I linked to is not an order entry application so you have to put your thinking cap on to envision how the parts work to create an order. I know lots of people link to the Northwind Traders sample but that is garbage in my opinion. Yes it is sort of an order entry but its schema is poor as are its naming standards and functionality. To translate the m-m sample, open the Employee form. Then think of employee as the order and classes as the items being ordered.