Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access query

Posted on 2001-06-17
6
Medium Priority
?
460 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
LVL 7

Accepted Solution

by:
Nosterdamus earned 320 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

618 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