Like I said -- I am a novice. Please see below.
Brief flow chart:
1. Purchase order received from customer.
2. Purchase order is assigned a control number and dealer.
3. Information is entered into my Orders form, which creates an OrderID
that I use for customer invoicing.
4. I transmit via email all of the information contained on the written
purchase order to the dealer for delivery.
5. When dealer delivers, he emails back to me -
a. Ship Date
b. Serial Numbers for that purchase order
c. His vendor invoice number(s)
d. His vendor cost(s) per invoice number
6. When I receive delivery info, I input, either manually or if
possible have computer link excel to access, the info in 5 above. This
information is forwarded via email (all of my SQL info) to corporate. That
is corporate's signal to pay dealer his share based on purchase order amount
and his costs.
7. I generate an invoice to the customer for payment.
Either I don't understand what you're doing, or there are some serious
problems with your data structure.
The SQL statement from your query shows that ControlNum is a field in
the Customers table, and not - as you stated - a unique identifier of a
purchase order. If PONumber stands for "purchase order", it's very odd
to have this field in the Customers table: normally it would go in the
Orders table to link your Order record to the purchase order issued by
the Customer. But maybe no one ever does business with you a second
time<g>.
I put the ControlNum in the Customers table because I did
not know how to do otherwise. It is possible to have a repeat customer; but
our business is with the government and, as a rule, is not the same
customer. The ControlNum is "my" main point of control. I receive a
purchase order from the government and assign that customer a control
number. Whenever I am searching for any information pertaining to the
purchase order, we use ControlNum rather than the government purchase order
number.
By the way, when you use the term "purchase order" do you mean the
entity modelled by your Orders table, or are "purchase orders" and
"orders" different things?
Purchase orders are received from the customer. Orders are
created when I enter the information from the purchase order.
Also, your JD Invoice Number and JD Invoice Amount fields are in the
Dealer table. This makes no sense, unless you never use a Dealer more
than once.
Again, I was uncertain as to where to put that information.
Yes, the dealer will be used many times. When I receive a "purchase order",
I assign a control number (unique to the purchase order) and dealer, and
email this via my excel template to the dealer. The dealer -- once delivery
is completed -- emails back either the form with my 4 fields completed -- or
can send info back in a separate worksheet. (This is where we began.)
When, and only when, the dealer lets me know that he has delivered AND sent
me the 4 pertinent items needed, can he receive payment for the delivery.
The way he receives payment is that I must transmit all of the info in the
SQL above - along with the 4 fields completed - to corporate and they issue
credit.
And there doesn't seem to be anywhere to store the serial numbers you
want the dealer to send you.
The only place that they will be visible is in my OrderDetails.
I will manually input the serial numbers sent back to me via dealer into the
original order entry form. I am using the Order ID as my invoice number
sent to the customer for payment.
It's always best to get the data structure right before trying to do the
fancy stuff.
I began this project with absolutely no idea of what or how this
was to be accomplished. Thus, my tables leave room for improvement.
Again, thank you for your patience and willingness to help me. I
have suddenly run out of time in my quest to complete this in a good,
workable fashion. I am 2 weeks shy of needing to complete.
THANKS
Replies below. As I am answering you, I think that I am indeed raising
more
questions than even the ones you asked.
This is raising more questions than answers. What tables do you have,
what are their primary keys, and how are they related?
Tables
ealer -( Primary Key = DealerID) DealerID to
Orders;
1 to many
Orders - ( Primary Key = OrdersID) CustomerID
to
Customers
Customers-( Primary Key = CustomerID)
CustomerID to Order Detail; 1 to many
Order Details - (Primary Key = OrderDetailsID)
Product ID to Products
Products - (Primary Key = Products) Contract ID to
Contracts
Contracts - (Primary Key = ContractID) Contracts
to
Products; 1 to many
Sin - (Primary Key = SINID) SinID to Products
The above relationships are the only ones showing up on my tables in the
query. When I look at all table relationships, I get the following:
Orders to Customer - not directly related
Order Details to Products - not directly related
Products to Contracts - not directly related
SIN to Products - not directly related
I have more tables that the ones listed above. The ones above are the
ones
pertaining to this query.
Is the control number the unique identifier of a purchase order?
Yes, each purchase order is manually assigned a control
number.
At one point it seems to be, when you say "each control number relates
to
a
specific purchase order for that customer" - but later you say "Each
product will have all the info I need specific to that particular
control number", which suggests that the control number relates to a
product rather than a purchase order.
No - control number relates to a purchase order wherein the
customer
purchases products under that control number. Sorry for my
inability to explain clearly.
About the query "that contains all information pertaining to [a]
specific control number"? Is it a parameter query? if not, where does
it
get the control number from? Please paste the SQL statement (from the
SQL view of the query) into your next message.
My present query is a select query. The control number comes
from
the customer table; this number is manually assigned in sequencial
order.
SELECT Orders.OrderDate, Contracts.ContractNum, Customers.PONumber,
Customers.CompanyName, Customers.ContactFirstName,
Customers.ContactLastName, Customers.ContactTitle,
Customers.BillingAddress,
Customers.City, Customers.StateOrProvince, Customers.PostalCode,
Orders.ShipName, Orders.ShipAddress, Orders.ShipCity,
Orders.ShipStateOrProvince, Orders.ShipPostalCode, Orders.ShipCountry,
Orders.ShipPhoneNumber, Orders.MarkForName, Orders.MarkForAddress,
Orders.MarkForCountry, Orders.MarkForPostalCode, [Order
Details].LineItem,
[Order Details].Quantity, Products.ProductCode, Products.ProductName,
Customers.ControlNum, [Order Details].SerialNum, [Order
Details].UnitPrice,
[Order Details]!UnitPrice*[Order Details]!Quantity AS [Total Price],
IIf([Total Price]>=0,[Total Price],Null) AS [Amount Before Trade-In],
IIf([Total Price]<0,[Total Price],Null) AS [Trade-In Amount], [Order
Details].OrderID, Orders.ShipDate, ([Amount Before Trade-In]*0.95) AS
[Dealere 95%], 0.05*[Amount Before Trade-In] AS [SEC 5%],
Dealer.DealerName,
Dealer.ContactPerson, Dealer.City, Dealer.State, Dealer.UnitCode,
Dealer.DealerNum, Dealer.DealerType, Dealer.DlvDlrJDInv AS [JD Invoice
#],
Dealer.[JDInv$] AS [JD Invoice Amount], Products.HandlingPct, [JD Invoice
Amount]*Products!HandlingPct AS [Handling $]
FROM (Dealer INNER JOIN (Customers INNER JOIN Orders ON
Customers.CustomerID
= Orders.CustomerID) ON Dealer.DealerID = Orders.DealerID) INNER JOIN
(Contracts INNER JOIN ((SIN INNER JOIN Products ON SIN.SINID =
Products.SINID) INNER JOIN [Order Details] ON Products.ProductID = [Order
Details].ProductID) ON Contracts.ContractID = Products.ContractID) ON
Orders.OrderID = [Order Details].OrderID
WHERE (((Customers.ControlNum)>=[forms]![ParamControl#]![Beginning
ControlNum] And (Customers.ControlNum)<=[forms]![ParamControl#]![Ending
ControlNum]));
Within this long SQL, you will see JD Invoice#, JDInv$,SerialNum,
ShipDate. This is the information that the dealer will insert into the
excel worksheet. At the present time, I have attempted to create a
template in excel that would put all of this information in legible
format
since my forms and reports will not email and allow protection of all
but these 4 cells and keep the format. I have been trying to find a way
to
do what we are talking about now. I must transmit all this
information
to the dealer in order that he make delivery. I could omit these 4
fields
and have them in a separate worksheet to link with access.
As for the serial numbers: Does every product you order have a serial
number, or only some of them?
Some of them
Presumably you have (or need) a 1:M
relationship between "order detail" records and "products delivered".
This would allow you to track which individual items were delivered
against which purchase order.
You are correct in your assumption.
Presumably you'd need something like that in any case to cover the
situation where (e.g.) you tell the dealer to deliver 10 x Acme Widgets
Model 99, but he only has two in stock. So he delivers those, and
orders
8 from his supplier, who only has 4 in stock, which are delivered a few
days later, while the remaining 4 have to be back ordered.