Cartesian Product I Thought I Have Prevented
Mar 12, 2007
Hi All,
This post is a bit long, but it is actually really simple. I have two tables(DEDPARM1 and DEDETAIL1). I ran a “CREATE TABLE” query using these two tables, to create a NEW table called “Biweekly_Temp_Table.”
DEDPARM1 sample data
SSN |Name |Type |Amount
555-99-8888 |Joe |FAE |2000
555-99-8888 |Joe |FAR |20
DEDETAIL1 sample data
SSN | Name | Type | Amount
555-99-8888 | Joe | FAE | 1000
555-99-8888 | Joe | FAR | 20
BIWEEKLY_TEMP_TABLE results
SSN | Name | Type| faeAmount | farAmount
555-99-8888 | Joe | FAE | 1000 | Null
555-99-8888 | Joe | FAR | Null | 20
This result makes sense, b/c it is what I wanted.
Now here is the problem. I ran another query(qrySingleRecord) against the BIWEEKLY_TEMP_TABLE to combine the TWO records into ONE. It works, BUT the faeAmount will equal 2000 and the farAmount equals 40. Why is Access doing this? I know something called Cartesian Product will occur if I query against both DEDPARM1 and DEDETAIL1. However, in this case I am NOT querying against these two tables; the whole purpose of creating a new table(BIWEEKLY_TEMP_TABLE) is to try to prevent Cartesian Product. Please help.
Thank you!
Joe
View Replies
ADVERTISEMENT
Aug 5, 2013
I am using a cartesian query to create multiple copies of a record to use for printing labels.
Here's my query that produces the cartesian result:
SELECT tblCount.CountID, tblDeliveryOrders.DeliveryOrderNum, CurrentCY.Deliveryorderlineitemnum, CurrentCY.Quant, CurrentCY.UOM1, tblContainerSizeCodes.SizeCode, tblContainerTypeCodes.TypeCode, CurrentCY.WasteDescription, tblEtidDodaac.EtidDodaac, CurrentCY.ETIDDocNum, CurrentCY.Pounds, tblEPAWasteCodes.[EPAWasteCodes(1B)]
[Code] ....
This works just fine in creating the desired result - EXCEPT I don't get all the records.
When I remove the 'cartesian table', and right join everything, then I get the correct results. If I keep everything as-is and reintroduce the cartesian table, then I get an error about there being an ambiguous outer join.
View 3 Replies
View Related
Aug 30, 2004
If I am going to get a Invoice/Statement programme made for me should it be in MS Access or Visual Basic, Thanks for your thoughts, Bob Vance
View 2 Replies
View Related
May 11, 2005
Hi all,
Hope this is the correct forum, and I am not breaking any rules of etiquette. :rolleyes:
I am after some guidance on how to start to tackle a problem, rather than any advice on the details of how to do it. That I want to work out for myself in order to try and improve my mastery of Access.
I have a team responsible for completing a number of scheduled reports.
These reports are scheduled for different frequecies ie :-
some are scheduled Weekly on a particular day,
some are scheduled Monthly on a particular date,
some are scheduled Monthly say on the 1st Monday of the month.
My goal, amongst others, is to be able to, from the switchboard,:-
a. Print a list of reports scheduled to run in the current work week.
b. Print a list of reports scheduled to run between any 2 inputted dates.
This is just part of what I want to acheive from this database, but as we all know Rome wasn't built in a day!! ;)
Grateful for any help / advice / directions,
Cheers,
fos605
View 1 Replies
View Related
Jan 5, 2006
I have a very simple database for recording data collected from a questionnaire. The database comprises of
table1: QUESTIONNAIRE
fields: QUESTIONNAIRE ID
QUEST_1 ........
up to QUEST_75
table2: VALUE (1 to 6)
ANSWER (strongly agree, agree etc)
All of the 75 question fields in table1 record the same information, and all look up to a table2 which stores the 6 values: agree (1), strongly agree (2), neither (3), disagree (4), strongly disagree (5) and spoilt (6). As the data is being entered into a from using option groups, the database stores the value rather than the text in each QUEST field.
Pretty straightforward I thought, but when I come to query the database I am getting into such a muddle I feel like my head is going to explode!!
The results I need to produce should look like this:
ANSWER QUEST_1 QUEST_2 ....all the way to QUEST_75
agree 34 3 25
strongly agree 45 5 34
neither 3 2 4
disagree 3 4 32
strongly disagree 3 3 5
spoilt 0 1 0
Basically all I want is a count of the number of answers for each question! Given that the answers for all the questions are the same I thought this would be a piece of cake, but alas no.
I thought I would simply be able to crosstab my results from the questionaire into a new table, which would have the six rows (agree, strongly agree etc) and the questions as fields. The values should be the count of "agree" etc. I can quite happly have one field and the counts of each answer but when I try an add any other fields it just duplicates the counts!! I have sat staring at my query and am at a complete blank as to how I resolve this seemly simplistic problem :confused: .
Please if anyone has any ideas why I am in such a muddle over something which seems so simple I would really appreciate their help!
Many thanks
View 13 Replies
View Related
Feb 15, 2005
Ive got a form, that has inputs to a table, and it also has 2 subforms that link to another table, the subforms are different forms but they link to the same table, this is bacause I need to be able to enter two different items off the table that may be different items, the reason Ive used subforms is because there is the need to have the part number for the item, as well as the weight, this will be a growing list as the Dbase expands.
now I have the two subforms with a combobox for part number, and the weight field looks up because of the combo,
back on the main form I need a entry that adds up the 2 weight fields, and enters them on the main table that the main form writes data to, can someone help?
Ive been heatbutting my monitor for a week or two now, and my limited know how on Access is beginning to show :-)
Thanks.
View 3 Replies
View Related
Mar 17, 2006
Hi..
I have a form called 'add product' and when the form is accessed it opens up a blank form.. the user scans the barcode of the product.. heres my question..
I want it to check the products table first to see if the barcode is already in there.. if it is... to bring the correct record up.. so that the quantity can be updated..if not.. to return an error message.. stating that the product already exists..
Any suggestions.. its been one of those days today.. cant think straight!
Cheers
View 5 Replies
View Related
Nov 11, 2007
Hi,
I have to calculate the quantity of the ordered products, grouped by Product_ID, and I have to be able to print this totals for specific dates.
For this query I need data from 3 tables:
tblProducts
Product_Name
tblOrders
Product_ID
Ordered_Quantity
tblCustomers
Delivery_Date
Products_Ready (Yes/No type, used for showing only those records which I need, in this case I will set it in my query to "No")
Whithout including in query Delivery_Date, everithing it's simple. I made a query, grouped by Product_ID, and running a sum on Ordered_Quantity.
But if I include Delivery_Date, because it can be different from order to order, the query doesn't show the totals the right way, once/Product_ID.
Can anyone help me on this? A piece of SQL code or everithing else is greatly appreciatde.
Thank you in advance, Attila
View 3 Replies
View Related
Oct 2, 2006
Hi,
Can some help, I have got a form with a field showing different product number on there, how is it possible to calculate the total of each product on the form?????
View 7 Replies
View Related
Oct 26, 2006
Thank you in advance for any assistance you be able to provide.
I would like some help on searching for product codes or serial numbers and formatting this into an order form a current customer form.
I have 4 main tables
CustomersID (PK)– Name, Address, City, Post Code, Tel Number
OrdersID(PK) – CustomersID(FK), Order Date,
OrderDetailsID(PK) - OrdersID(FK), ProductID(FK), Quantity
ProductsID(PK) - Code Number, Serial Number, Description, Color, Unit Price
I think I have all of these linked correctly
Here's what I am trying to achieve (so far with little success)
I have a customer form that I fill in name address etc; I then have a button that will take me to a customer order form, easy so far.
In my product table there are about 2000 separate products (spare parts for electrical appliances) so what I would like is for a popup box to appear when the order form is loaded (as a drop down or combo box isn’t practical ) so I can search for the product by code number or serial number only for a particular spare part. The description and price are fixed in the products table and should not be changed on the customer order form, I would then like the selection of the code to transpose to the order form.
In other words I would like when the code number has been entered and the product found that the info should then be added to the order form (model or serial number, part description, color and price all taken from the products table) I would like it that when the product has appeared on the order form that it cannot be changed, only by being deleted.
I know this appears to be rather basic but for some reason I am hitting a brick wall, I have looked at many db's and even tried to dissect Northwind to do what I want but cannot make it happen, now after 8 days in the wilderness I need help or guidance.
Thanks in advance
Kim
View 4 Replies
View Related
Oct 20, 2006
I have been away from access for a while now and I am sure that this is simple. I tried a search but found nothing.
The issue:
A)The user enters in a product number, if not found then a message appears to tell them so...this I know how to do
B)If the product is in the table then I would like it to display some of the fields on the form.
EX: Prd # 0659875
MSG = does not exist
ExB) prd #: 0584785
Reason No.:1
Description: abcdefg hijklm nopqr stuvwxyz
So the whole this is how do I populate the text boxes that display the fields with the proper searched critera (prd. no.)
Thanks,
viper
View 3 Replies
View Related
Jan 13, 2007
Hi
I've been trying to get my head around this and after coming up with no search results Gonna ask for ya help.
I've attached a jpg which uses sample data so nobody needs worry as the program displayed will still be available free.
What I'm trying to do is:-
Should a user build programs for general sale they can then sell the first copy at full price but should a customer wish to install other copies then the user will have the option of selling additional copies at decreasing rates depending on how many copies a client purchasesHas so saying that looking at the jpg if I was to bye a program for a network of 20 systems and want to install legal copies on each I would pay the full price for copy 1 and Ł75 For copies 2-20
My thinking is I first check for any multiie prices for a product when the productID is selected then if that returns >0 then I need to check the invoice system to see if a client has already payed for X copies that way I can get the correct price for the EstimateInvoice.
The Problem I'm having is I can't seem to get my head around the getting the correct record as it uses a low and high number with a listed price Please see Jpg I have been thinking of using Between Low and High of Low >= X And High<=Y But that's bothering me as I'm not sure if it would just return one record.
If returned more than one record maybe I could use sorting to get me the lowest price for X & Y but I don't feel happy with that?.
Hope that makes sense
Many Thanks
Mick
View 7 Replies
View Related
Feb 23, 2007
I'm new to Access (2002) and have been trying to learn by reading books, posts, forums and practicing with models. I've set up a database for inventory, primarily to track the cost of goods sold as raw material costs change from month to month. So far I have tables for raw materials, container sizes, suppliers, and finished products. But I have a problem - in some cases a finished product is also a raw material, so cannot appear in both tables. (Let's say we make cookies and we make ice cream, and we also make ice cream with cookies on top as a third/separate finished product!) Should cookies have two records ('CookieFinished' and 'CookieRM') and can they be linked together so cost is determined before it's part of another? Is there a better way? Thanks in advance!
View 9 Replies
View Related
Dec 1, 2006
I have 2 tables a project table and a project additions table, they have a relationship of 1 to many. When I run the query using both tables it only gives me the results of the project numbers that match in both fields. I need to have all information from both fields.
View 1 Replies
View Related
Jul 18, 2005
I have started a type of CRM database in which all my customer information and product info is stored.
In order to create quotations for each customer, I want to be able to search and select products by product ID, adding quantities if necessary, to be printed as a report.
Any ideas?
Many thanks
View 2 Replies
View Related
Sep 19, 2014
I'm going to design an access database for an LPGas company. This company sells LPGas and LPGas cylinders.
Suppliers:
1.AlfaCylinder supplies it's cylinders(not the same kinds of cylinder as ME's)
2.MECylinder supplies it's cylinders(not the same kinds of cylinder as Alfa's)
3.PerfectGas Co. supplies it's LPGas.
Products :
This company sells cylinders and fills different kinds of cylinders with LPGas. for example, 11 kilogram LPGas in one kind and 25 kilogram LPGas in another kind and so on. Therefore, products are :
See the attachment
No problem with customers table. There are two kinds of customer. 1. Known customers 2. Unknown (everyday changing) customers. (there is a record for them in customer table named as Uncustomers, that at the end of the day, the sum of sale of this kind entered under this name.)
Problem is : As you see, there are some products with the same ID and same name or same type but different prices. How can I arrange the product table?
View 4 Replies
View Related
Jul 23, 2013
How would i set up a table for a list,.. ie.
For each product there is a list of 5-10 things?
Product1.....Product2
a...............f
b...............g
c...............h
d...............i
e...............J
There can be new products added and new subs in the products. How can i build my table to correspond with data integrity?
View 1 Replies
View Related
Feb 21, 2012
I've got an order detail form which has
product id, product description, customer, quantity and below the form a Total quantity
When I enter the same product id, and when i press the button to update, the table of stock quantity deducts from total quantity
If I use different product ids, it doesn't work, but updates only the current product id, where the mouse current record is set by mouse.
By the way i use dlookup to check if the stockquantity has enough items.
View 10 Replies
View Related
Jun 25, 2014
I was creating a access web app for my company and want to create a data for its product. Each product will have multiple colors and different material are used for each color. The number of colorways for a product varies.
We want to be able to select a product and a lookup field will appears for us to choose its colorway.
View 6 Replies
View Related
Jun 30, 2006
OK, here's my delima (my head is spinning)
I have a standard Product table:
tblProducts
ProductID (PK)
ProductName
VendorName
Description
UnitPrice
InStock
Every Product has many Parts, but one Part may go to many Products
I will build this table:
tblProductParts
PartID (PK)
PartName
VendorName
Description
UnitPrice
InStock
How would I relate them together? I figure I need to use a Many to Many, with this table inbetween:
tblProductPartsList
ProductPartsListID (PK)
ProductID (FK to tblProducts)
PartID (FK to tblProductParts)
I feel like I'm missing something, can you let me know what you think???
THANKS!!!
View 5 Replies
View Related
Aug 23, 2006
Hi
In my database i have a field called product code which the user enters the code as T0001, T0002, T0003 and so on for each record.
would it be possible when adding a new record for that field to auto fill the product code as T0004 for example, so the user doesnt have to type the code in all the time.
please help, ty
View 1 Replies
View Related
Jun 20, 2007
Hi,
i am developing a clothing order management database.
I have so far got [order details], [products], [product details] entities.
This is so that products with the same model code can have a selection of colours and sizes which are held in the product details table.
I followed this website which was very helpful: http://www.princeton.edu/~rcurtis/ul...database2.html
The question is now: each size and colour will have a different stock quantity. How do i model this, for example, so when a Small Red t-shirt is added, the small red t-shirts quantity decreases rather than the overall quantity for the model.
any ideas?
View 1 Replies
View Related
Mar 4, 2008
Hi guys,
quick question,
I have a problem in which I want to create a validation rule for product references of products in a bookstore. I have devised their system to work by having the following formats
•CD’s will have a the letters “CD” as a prefix and have 7 numbers afterward e.g. CD7251941
•DVD’s will have a the letters “DV” as a prefix and have 7 numbers afterward e.g DV4752930
•Products made in house will have a the letters “IH” as a prefix and have 7 numbers afterward e.g. IH2093842
•Miscellaneous items will have the letters MS as a prefix and 7 numbers afterwards e.g. MS041421
I have already put an input mask so it would be of the correct type of character: LL/0000000;;_
Now i want to create a validation rule to ensure that the prefix is either CD, DV, IH or MS followed by 7 numbers. Does anyone know an expression which can do this?.
Daniel
View 2 Replies
View Related
Oct 8, 2007
:(I have a Customer Order form with a Order Detail sub form, The problem I have is that using the productID Combo, IT shows all 6000 products, I need a way to MANUALY enter the ProductID which then will find the relevant record and fill in the rest of the fields in the Sub Detail Order Form.
View 1 Replies
View Related
Jun 28, 2005
I need a basic Product database that allows you to have a drop down menu to select a product from a table. In turn this puts the unit price in for you, you then put the quantity in and it calculates the total.
I also have a stock control. When one is bought it takes the quantity down. Very simple I know but I can’t get it to work….
If there are any good basic database templates i could use let me know
I have attached a sample zip file
D
View 2 Replies
View Related
Jul 12, 2005
Hi!
I need to create a database of the info of a few hundred companies. Each company (food producers) specializes in various product categories, not just one. This is my problem/question: each company entry should then have a possibility to have as many product categories as needed. How can I do this without using "free text" fields? The website user should obviously also be able to search the db - by clicking checkboxes with the categories maybe?
(+Also: When the admin user needs to add the info of a new company (with, say, 9 product types) into the database, what kind of an SQL clause I need to INSERT INTO the db? For example if the product categories where laid out as checkboxes, and the user would just click the ones he wants.)
View 8 Replies
View Related