473,405 Members | 2,261 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,405 software developers and data experts.

How I display all records using Dynamic queries on a report.

274 100+
Hi Everyone,
I am struct with one report. I use a number of recordsets to meet requirements of my report. It works fine but the problem is:
It displays only first record; I need to have all records. I don't know how I can do that. Here is partial code of my DataReport in VB6

For Each sect In RptDailyClosingSummarytrial.Sections
Expand|Select|Wrap|Line Numbers
  1.  
  2.       Debug.Print "Section", sect.Name
  3.       For Each ctl In sect.Controls
  4.  
  5.          'for different status of emplyes
  6.              If ctl.Name = "dates" Then
  7.                 ctl.Caption = strdates
  8.              End If
  9.              If ctl.Name = "lblName" Then
  10.                 ctl.Caption = RS.Fields!company_name
  11.              End If
  12.              If ctl.Name = "lblAddress" Then
  13.                ctl.Caption = RS.Fields!address
  14.              End If
  15.              If ctl.Name = "lblCity" Then
  16.                 If IsNull(RS.Fields!city) Then
  17.                 ctl.Caption = ""
  18.                 Else
  19.                 ctl.Caption = RS.Fields!city
  20.                 End If
  21.              End If
  22.  
  23.              If ctl.Name = "lblPostalCode" Then
  24.                 If IsNull(RS.Fields!postal_code) Then
  25.                 ctl.Caption = ""
  26.                 Else
  27.                 ctl.Caption = RS.Fields!postal_code
  28.                 End If
  29.              End If
  30.  
  31.              If ctl.Name = "lblProvince" Then
  32.                  If IsNull(RS.Fields!province) Then
  33.                  ctl.Caption = ""
  34.                  Else
  35.                  ctl.Caption = RS.Fields!province
  36.                  End If
  37.              End If
  38.              If ctl.Name = "lblPhoneNo" Then
  39.                 If IsNull(RS.Fields!phone_number) Then
  40.                 ctl.Caption = ""
  41.                 Else
  42.                 ctl.Caption = RS.Fields!phone_number
  43.                 End If
  44.              End If
  45.     '''''''''''''''''Record count''''''''''''''
  46.              If ctl.Name = "counts" Then
  47.                 If IsNull(PS.Fields!Con) Then
  48.                 ctl.Caption = "0.0"
  49.                 Else
  50.                 ctl.Caption = PS.Fields!Con
  51.                 End If
  52.              End If
  53.  
  54.          ''''''''''txtgroup_id'''''''''''''''
  55.       If ctl.Name = "txtGroup_ID" Then
  56.  
  57.                 ctl.Caption = oRS.Fields!group_id
  58.      End If
  59.      ''''''''''''''''''txtname'''''''''
  60.      If ctl.Name = "txtName" Then
  61.  
  62.                 ctl.Caption = oRS.Fields!Name
  63.      End If
  64.          ''''''''''''''''''txtPrice1''''''''
  65.      If ctl.Name = "txtPrice1" Then
  66.  
  67.                 ctl.Caption = oRS.Fields!price1
  68.      End If
  69.  
  70.           ''''''''''''''''''txtgst1''''''''
  71.      If ctl.Name = "txtgst1" Then
  72.  
  73.                 ctl.Caption = NS.Fields!gst1
  74.      End If
  75.  
  76.  
  77.  
  78.  
  79.      ''''''''''subtotal'''''''''''''''
  80.      If ctl.Name = "subtotal" Then
  81.                 If IsNull(PS.Fields!sum1) Then
  82.                 ctl.Caption = "0.00"
  83.                 Else
  84.                 ctl.Caption = Format(PS.Fields!sum1, "########0.00")
  85.                 End If
  86.      End If
  87.      '''''''''''''''gst'''''''''''''''
  88.      If ctl.Name = "gst" Then
  89.                 If IsNull(PS.Fields!sum2) Then
  90.                 ctl.Caption = "0.00"
  91.                 Else
  92.                 ctl.Caption = Format(PS.Fields!sum2, "########0.00")
  93.                 End If
  94.      End If
  95.      '''''''''''''''''grand total''''''
  96.      If ctl.Name = "grandtotal" Then
  97.                 If IsNull(PS.Fields!sum3) Then
  98.                 ctl.Caption = "0.00"
  99.                 Else
  100.                 ctl.Caption = Format(PS.Fields!sum3, "########0.00")
  101.                 End If
  102.      End If
  103.      '''''''''''''''Average'''''''''''''
  104.      If ctl.Name = "average" Then
  105.                 If IsNull(PS.Fields!net) Then
  106.                 ctl.Caption = "0.00"
  107.                 Else
  108.                 ctl.Caption = Format(PS.Fields!net, "########0.00")
  109.                 End If
  110.      End If
  111.      ''''''''''''''''''''''''''''''''''''
  112.      '''''''''''''''Cash Transections'''''''''''''
  113.      If ctl.Name = "lblCashTran" Then
  114.                 If IsNull(GS.Fields!sum3) Then
  115.                 ctl.Caption = "0.00"
  116.                 Else
  117.                 ctl.Caption = Format(GS.Fields!sum3, "########0.00")
  118.                 End If
  119.      End If
  120.      ''''''''''''''''''''''''''''''''''''
  121.       '''''''''''''''Account Transections'''''''''''''
  122.      If ctl.Name = "lblChqOut" Then
  123.                 If (MS.RecordCount = 0) Then
  124.                 ctl.Caption = "0.00"
  125.                 Else
  126.  
  127.                 ctl.Caption = Format(MS.Fields!sum3, "########0.00")
  128.                 End If
  129.      End If
  130.      ''''''''''''''''''''''''''''''''''''
  131.    ' oRS.MoveNext
  132.     Next ctl
  133.  
  134.  Next sect
any help will be highly appreciated.
thanks in advance
Regards
Dec 21 '07 #1
2 1099
creative1
274 100+
Hi Everyone,
I really need help for this report that Posted yesterday got no reply from anyone. I think I won't be able to do it on my own I have been trying this since last week.
I think the way I ask is too complex that no one understands what I want.
Here is another attempt to make my question simple

In datareport details section, I have following fields to display
Group Code Group Name Amount GST Subtotal

amoung these five fields GST is computed different query( as done in recordset ORS ) and rest of the fields are taken from another(As done is recordset NS);
chances are there there is no gst for group codes but there can be some value for Amount.

there are only four groups (Metals, Papers, UBC, MISC)
Now the problem is:
If I set datasource to ORS. Everything is ok except GST. GST calculated for first group(Metals) is repeated for all groups.

I set datasource to something else other than ORS, and NS. It prints information for group only. I tried do while, for, move next first, last and everything else I knew but no luck.

I badly need your help. So please gimme any tip you guys know. I don't want any source code only an Expert tip. Have someone ever worked on a report like this one?
Dec 22 '07 #2
creative1
274 100+
Hi Everyone,
I think nobody ever get what my question was.....never mind

I solved the mystery after a long struggle. If anyone would be intereted in knowing how I did it. I will be pleased to reply. I can't tell how many different method I tried to get the solution.
Regards
Dec 24 '07 #3

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

Similar topics

2
by: Tony Kennedy | last post by:
Hi, We have a SQL server db backend for our ERP system. I have written a Crystal Report to extract data from one particular table called itemspecbomw (c.30000 records) which contains amongst...
7
by: Eric Slan | last post by:
Hello All: I'm having a problem that's been baffling me for a few days and I seek counsel here. I have an Access 2000 DB from which I want to run several reports. These reports are...
5
by: Terri | last post by:
I have a form with a multi-select combo. I dynamically build a SELECT statement, open a report, and set the recordsource to my dynamic SELECT statement. I count the records returned in the report...
3
by: matthewemiclea | last post by:
I am trying to display information in Access on a form that takes information from many different queries and puts them together on a spreadsheet or chart. Some specific info: The information I...
15
by: brettclare | last post by:
I have linked a large SQL Server table to Access, however 'only' 2,195,439 records are shown and are available to query. Can I increase the size (cache??)/number of records showing in Access? ...
6
by: geronimo_me | last post by:
I have 20 queries that compare fields in one table with fields in another table - the query results are the records that do not match in Table1 and Table2. ie Table1 DOB 28/02/78 Table2 DOB...
0
by: loga123 | last post by:
Hi All, I have a requirement where I need to build a dynamic gridview. I am using asp .net 2.0. I have to display non-key columns of a table in the gridview and make user to be able to...
3
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
1
by: =?Utf-8?B?UnVzc2VsIExvc2tp?= | last post by:
I am developing a web application using VS 2008. We have included the AjaxControlToolkit. We have a report page. You select the fields you want to see and the filters you want to apply. They...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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
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...
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.