473,394 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help me in this report

Hi all,
I am not so good in queries. here is my problem

2 tables to store the received items (fabric)-- inwardmaster,
inwarddetails

and after some processing (Dyeing)

the items were deliverd and stored in tables -- deliverymaster,
deliverydetails

some times it may me returned without processing (grey fabric) and
stored in -- returnmaster and returndetails

lng_LI_RecordNo is the primary and used in delivery and return tables.

i want to take a report like this

STATUS REPORT BETWEEN 01/9/2005 AND 30/9/2005

--------------------------------------------------------------------------------
CUSTOMER NAME OPENING BALANCE INWARD QTY DELIVERD QTY RETURN QTY
CLOS.BAL
--------------------------------------------------------------------------------

i tried to calculate like this

first get the customers who gave fabric < 01/09/2005
start customer loop

get total inward qty of customer < 01/09/2005
get total delivery qty of customer < 01/09/2005
get total return qty of customer < 01/09/2005

opening balance = total inward qty - (devliered qty + retured qty)

get total inward qty of customer between 01/09/2005 and 30/09/2005
get total delivery qty of customer < 01/09/2005 and 30/09/2005
get total return qty of customer < 01/09/2005 and 30/09/2005

Closing balance = opening balance + total inward qty - (devliered qty
+ retured qty)

update values in new table and show it in crystal report.

end customer loop

with this method it takes more than 45 minutes to get the report, pls
help me to write a single query which does all this or help me the
other way to get the report fast. i use vb6 with access 2000.

pls help me.

prabhu.

Nov 13 '05 #1
1 1775
pr**********@gmail.com wrote:
Hi all,
I am not so good in queries. here is my problem

2 tables to store the received items (fabric)-- inwardmaster,
inwarddetails

and after some processing (Dyeing)

the items were deliverd and stored in tables -- deliverymaster,
deliverydetails

some times it may me returned without processing (grey fabric) and
stored in -- returnmaster and returndetails

lng_LI_RecordNo is the primary and used in delivery and return tables.

i want to take a report like this

STATUS REPORT BETWEEN 01/9/2005 AND 30/9/2005

--------------------------------------------------------------------------------
CUSTOMER NAME OPENING BALANCE INWARD QTY DELIVERD QTY RETURN QTY
CLOS.BAL
--------------------------------------------------------------------------------

i tried to calculate like this

first get the customers who gave fabric < 01/09/2005
start customer loop

get total inward qty of customer < 01/09/2005
get total delivery qty of customer < 01/09/2005
get total return qty of customer < 01/09/2005

opening balance = total inward qty - (devliered qty + retured qty)

get total inward qty of customer between 01/09/2005 and 30/09/2005
get total delivery qty of customer < 01/09/2005 and 30/09/2005
get total return qty of customer < 01/09/2005 and 30/09/2005

Closing balance = opening balance + total inward qty - (devliered qty
+ retured qty)

update values in new table and show it in crystal report.

end customer loop

with this method it takes more than 45 minutes to get the report, pls
help me to write a single query which does all this or help me the
other way to get the report fast. i use vb6 with access 2000.

pls help me.

prabhu.

45 Minutes!!!! Wow! That doesn't say much for Crystal Reports.

Here's a method I may use in Access.

I may have a form called CallRpt. In it I would have 3 text fields that
store dates; LessThanDate, BetweenFromDate, and BetweenToDate.

I would then create 6 queries that do totalling. Ex:
Select inwardmaster.customerid,
Sum(inwardDetail.inwardqty) As InDelTot _
from inwardmaster INNER JOIN inwardDetail On _
inwardmaster.lng_LI_RecordNo = _
inwardDetail.lng_LI_RecordNo _
Where inwardDetail.InwardDate < LessThanDate _
Group By inwardmaster.customerid

This will select all customers with records less than the LessThanDate.

Select inwardmaster.customerid,
Sum(inwardDetail.inwardqty) As InDelTot _
from inwardmaster INNER JOIN inwardDetail On _
inwardmaster.lng_LI_RecordNo = _
inwardDetail.lng_LI_RecordNo _
Where inwardDetail.InwardDate Between _
[Forms]![CallRpt]![FromDate] And _
[Forms]![CallRpt]![ToDate] _
Group By inwardmaster.customerid

This query will select and total all qty by customerid with dates
between the From/To Dates.

Now do the same thing for Returns and Deleivery.

You now have 6 queries with the sums for all six Totals that you require.

You now need a "master" query to link the customerID to all of the other
queries. Perhaps one of these 6 can be the master. Basically, you want
to only select customer records that has a record in 1 of these 6 queries.

Lets use the customer table as the master. Drop that and the 6 queries
into the query builder. Now create a relationship line of customer Id
to all 6 tables. Right click the relationship line and set it to All
records in Customer and only those that match for the table in the
relationship.

Now you can filter this table down where you check the value of the Sum.
I would use IsNull. Ex:
Not IsNull(InDelTot) Or Not IsNull(ReturnTot) Or Not
IsNull(DeliveryTot)....etc.

Now you have a query that will select only customers that have an
inward, delivery, or return record that meets the time frames specified.
If the customr has no records, all of the "sum" fields will be null.

From here you can use the report writer to perform calculations on the
fields.

This will bring down the reporting function from 45 minutes to about 2
seconds.
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Phin | last post by:
I need your HELP! I've seen all the posts on using Crystal Reports within vs.net (vb.net) and changing a SQL query at runtime. When I tried to pass in a dataset into the crystal report at...
5
by: MGFoster | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've converted an ACC97 .mdb file to an ACC2K2 .adp. A report that worked in ACC97 doesn't work in ACC2K2. Report setup: ACC97 ...
1
by: Simon Matthews | last post by:
Hope someone can help an Access beginner! I've just started keeping my surgical logbook on access and it's a simple flat-file affair. I have created several queries that will list cases...
5
by: Steve Patrick | last post by:
Hi All You guys are my last hope, despite spending money on books and hours reading them I still can not achieve the results I need. I have designed a database in Access 2000 based on 1 table,...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
3
by: Deasun | last post by:
I need some help please! Crystal is driving me nuts. Heres my code so far, see below. Problem: On the .export() line it comes back with error #5 Login failed! I know the login info is good so...
1
by: PlumeProg | last post by:
Hello, I can't find a way to bind a dataset at runtime as a source for my report source. I looked into msdn and found some sample : ms-...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
3
by: DeanL | last post by:
Hi guys, I'm in need of a little help with a report I'm setting up on Access 2000. The report shows data depending on entries on a form that has 7 fields (Min and Max Cost, Fiscal Year, Min and...
3
by: jambonjamasb | last post by:
Hi I have two tables: email_tbl Data_table Data table is is used to create a Form Data_form
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.