Solved

Access query

Posted on 2001-06-17
6
427 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

816 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

10 Experts available now in Live!

Get 1:1 Help Now