Solved

Access query

Posted on 2001-06-17
6
419 Views
Last Modified: 2010-05-18
Hi,

Here I m giving Structures of Tables n some dummy records.

Table Open_stock
----------------
ScriptName          Text
Customer            Text
Stock_date          Date
Qty                 Number
Price               Number

Table Script
--------------
Short_name          Text
Long_name           Text

Table Customer
--------------
Short_name          Text
Long_name           Text

Table Transaction
--------------
Date                Date
Customer            Text
Script              Text
Tran_type           Text
Qty                 Number
Rate                Number
Amount              Number

        Dummy Records for the Above Tables
************************************************************************
Table Open_stock
-----------------
Script  Customer        Stock_date      Qty      Price
------------------------------------------------------
R       C1              1/4/2000        200      35.00
A       C2              1/4/2000        100      40.00
V       C3              1/4/2000        100      45.00

************************************************************************
Table Script
-------------
Short_Name  Long_Name
-----------------------------------------------------
R                 Rr
A                 Aa
T                 Tt
************************************************************************
Table Customer
--------------
Short_name     Long_name
------------------------------------------------------------------------
C1             Abcd
C2             Bcde
C3             Cdef
************************************************************************
Table  Transaction
-------------------
Date     Customer Script  Tran_type   Qty  Rate    Amount
---------------------------------------------------------
09/5/00  C1       R       Purchase    200  35.00  7000.00
09/5/00  C1       T       Purchase    100  30.00  3000.00
10/6/00  C2       R       Purchase    100  40.00  4000.00
15/6/00  C1       R       Purchase    300  40.00 12000.00
05/7/00  C1       R       Sales       200  45.00  9000.00
12/7/00  C1       R       Purchase    100  40.00  4000.00
15/7/00  C1       R       Sales       300  55.00 16500.00
23/7/00  C2       A       Purchase    100  40.00  4000.00
25/7/00  C3       T       Sales       100  50.00  5000.00
31/7/00  C3       R       Purchase    200  50.00 10000.00
15/8/00  C1       R       Sales       200  65.00 13000.00
25/8/00  C1       R       Purchase    100  50.00  5000.00
15/9/00  C2       R       Sales       100  55.00  5500.00
************************************************************************

These are the Table Structure n Records.

I want FIFO Query in Access.

Please Reply me ASAP.

Thanx,

Tejas
 
0
Comment
Question by:teju
6 Comments
 
LVL 7

Expert Comment

by:Nosterdamus
ID: 6199955
Hi teju,

1. What do you need the query to do?
It can CREATE a new table, it can UPDATE an existing one, it can just SELECT items from a table and display it on screen through a Form or Report etc,.

2. What is the field that should be used to determine the FistIN (for the FIFO)? Is it field Date from Table Transaction?


Nosterdamus
0
 

Expert Comment

by:DevAlex
ID: 6200102
Hi Tejas,

Whenever I get really complex queries I try to break them down into easier to manage sub-steps.  To do FIFO you'll need a date & time stamp - so you'll know which one to grab (or you could use the record # since they are in sequence too).  {To everyone reading this FIFO means First In First Out}.

Often I'll create a query that queries another query (& even sometimes queries it yet another time to get to the solution I want).

OR if you feel more comfortable (seems like your doing a lot - making this the right answer) --> Create an Access VBA function or sub that goes through step by step creating your answer (ie, build a table with the answer set then you can do a simple query to that).  I've found this to be the easiest way to handle these types of things.

Rgds,
DevAlex
0
 

Author Comment

by:teju
ID: 6209099
I want answer in this format.
for ex time period is 1/7/00 to 31/7/00.

Date       Script     Qnt     Rate      Amount
31/07/00   R
31/07/00   T
31/07/00   A
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 7

Accepted Solution

by:
Nosterdamus earned 80 total points
ID: 6209614
Hi teju,

To get this:

Date       Script     Qnt     Rate      Amount
31/07/00   R
31/07/00   T
31/07/00   A

Use,

QueryTrans:
SELECT Transaction.Date, Transaction.Script, Transaction.Qty, Transaction.Rate, Transaction.Amount
FROM Transaction
WHERE Date >= #07/01/00# AND Date <= #07/31/00#
ORDER BY Date;

Note that the date format is mm/dd/yy. You should use this format even if your regional settings are set to something differen (e.g. dd/mm/yy).

Hope this helps,

Nosterdamus
0
 

Expert Comment

by:amp072397
ID: 6742555
teju hasn't logged in since the date of Nosterdamus' last comment. Points will be awarded to Nost' in about 7 days unless teju returns with a viable objections.

thanks!
amp
community support moderator
0
 

Expert Comment

by:amp072397
ID: 6758970
(I need a script for this)

Points to Nost'.
amp
community support moderator
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HasData 9 37
MS Access creating a Chart from Search result on Form view 2 21
count unique records in access report 2 23
Export Query data to excel file 14 36
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now