473,473 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Received quantity distributed based on order number and order date

1 New Member
Hello,

I'd like to perform a report based on 2 tables (Order Table and Reception Table):


Expand|Select|Wrap|Line Numbers
  1. Order Table
  2. OrderID (PK)|Item(PK)|Ref   |Qty|Order Date
  3. 1           |1       |Orange|5  |20/01/2016
  4. 1           |2       |Orange|3  |22/01/2016
  5. 1           |3       |Orange|2  |22/01/2016
Expand|Select|Wrap|Line Numbers
  1. Reception Table
  2. RecpID|OrdernumFK|Qty|ReceptionDate
  3. 1     |1         |2  |22/01/2016
  4. 2     |1         |7  |23/01/2016
Via a request, I would like to be able to fill a table like this

Expand|Select|Wrap|Line Numbers
  1. Table request (Reporting)
  2. OrderID (PK)|Item(PK)|Ref   |Received Qty|
  3. 1           |1       |Orange|2
  4. 1           |1       |Orange|3
  5. 1           |2       |Orange|3
  6. 1           |3       |Orange|1 
  7. (it remains 1 qty to full-fille line)
Would it be possible to perform something like that in access?

I would like to distribute the received qty based on order num and order item + date of reception of the good?

I have programming skill on vba on excel 2010, I think it might be possible to use it for access 2010?

Thanks beforehand for your help.

Arte
Attached Files
File Type: zip OTIF.zip (26.0 KB, 50 views)
Feb 10 '16 #1
1 901
zmbd
5,501 Recognized Expert Moderator Expert
+ most of our experts are not able to d/l unrequested attachments, mainly due to IT-Security policies and/or firewalls.

+You wouldn't add another table here instead create a query.

Open the query editor

Show the [Order] table
Show the [Reception] table

It appears that the related field is between:
[Order]![OrderID] and [Reception]![OrderNumFK]

Once that relationship is created, decide if you want to show all of the [Order] table and matching [reception], only matching records between the two (default) or all of the [Reception] table records and matching [Order]

Now drag into the grid (or use the dropdown lists)
[Order]![OrderID]; [Order]![Item(pk)]; [Order]![Ref]; [Reception]![Qty]

Line 7 of the desired "table" is more problematic. This is not something that you can do with either a data-table nor directly within a query. What you can do is create an aggregate query that sums against [Order]![Qty] grouped by [Order]![OrderID].

From there I'll have to think about how to work the two together. This isn't something I usually do so I've not an easy solution for that. However, I think you'll be able to do a calculated control in either a form or a report to show the line as desired. You might be able to build a union query for this; however, I'll have to give that some thought.

--
Unlike a spreadsheet/workbook, it's not a good idea to duplicate the data as proposed in the original post Database Normalization and Table Structures

--

I am guessing that you primary key for [Order] is a composite key based on both [Order]![OrderID (pk)] and [Order]![Item (pk)] ?

Are the field names actually [OrderID (pk)] and [Item (pk)]
or are they [OrderID] and [Item]?

+ Composite keys as primary keys, will cause you some difficulties down the road. I do use composite indexes; however, I use a single field for my primary key - usually an autonumber field. This is after years of programing and building databases. Composite keys sound great, people swear by them, and they are a pain to work with.

+ If you are actually using the "()" in names, I highly advise changing the design now. This may cause you issues in the very near future:
... Error message when you use special characters in Access databases
... Access 2007 reserved words and symbols
... Problem names and reserved words in Access

It's old school; however, I highly advise not using spaces or anything other than alpha-numeric and the underscore for names in tables, queries, forms, controls, and fields.
--
Feb 12 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: L'Angel Admirable | last post by:
Hi, all, I have this table in which each row is associated with a category number. The category number is NOT unique, so basically more than one row in the table can have the same category...
4
by: Mark | last post by:
Hi I have been trying to convert the week number to a range of dates that I can use. It should be fairly simple for you guru's out there but for us mere mortals it is beyond our grasp. I know...
6
by: Scott Kilbourn | last post by:
Hi, I'm writing a control that inherits from TextBox. I need to adjust the width of this control based on the number of characters in the control. I'm having a hard time with this. The...
7
by: No bother | last post by:
I have a table which has, among other fields, a date field. I want to get a count of records where certain criteria are met for, say, three days in a row. For example: NumWidgets Date...
5
theaybaras
by: theaybaras | last post by:
Hi, I'm still getting a feel for some things in Access. What I have is a database of scientific articles. I have an unbound memo field in which I want to have the APA style citation concatenated...
6
by: vdicarlo | last post by:
I am a programming amateur and a Python newbie who needs to convert about 100,000,000 strings of the form "1999-12-30" into ordinal dates for sorting, comparison, and calculations. Though my script...
1
by: Deccypher | last post by:
Hi I am trying to give my customers an option to save favorite products for easy storage and reorderig. it works great and on the single item add to cart i have no problem, how ever i would also...
25
by: DanicaDear | last post by:
Hello again Bytes...I missed you! First, background: In a hotstick lab, we ship orders every two years. We ship a new order and the customer uses the new box to return the previous year's order....
12
by: klbrownie | last post by:
Hello, I am trying to get a date field to autofill based on the date of another date field. I want the autofilled date to be 30 days after the other date. For example, if the user has entered...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.