473,657 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parameter Query of Access is not Available in VB DataReport

18 New Member
I am designing a data report in VB6. In data environment it is possible to selet tables and 'select quries'. But I want to generate a report based on parameters passed by user, so i had created a parameter query in ACCESS which is not available in the properties of command1.

SQL code of query is as under :
SELECT Customers.accou nt_no, Customers.card_ no, Customers.name, payments.amount , payments.paymen t_date, dlt_3.[Second last Date], total_amount.[Sum Of amount]
FROM ((Customers INNER JOIN dlt_3 ON Customers.accou nt_no = dlt_3.account_n o) INNER JOIN total_amount ON Customers.accou nt_no = total_amount.ac count_no) INNER JOIN payments ON Customers.accou nt_no = payments.accoun t_no
WHERE (((payments.pay ment_date) Between [enter date 1 :] And [enter date 2 :]))
ORDER BY Customers.accou nt_no;

Please help me to generate report based on user input.
Aug 2 '07 #1
4 1896
ashutoshvyas
18 New Member
Hello Everybody.
I had solved the above question by adding sql command1 in the data environment and by writing the procedure for form which can accept the parameters from the user and will pass value to the query and then generation of report based on that query.

But a new problem had arised.
I want to give serial numbers to all the records which are generated in the report by the means of above mentioned query.

Help from any one is appriciated.
Aug 3 '07 #2
JonJacobs
25 New Member
SQLServer has Identity fields that are basically auto-increment numerics. I don't know if Access has something like that, but if it does, then create a temporary table with an auto-increment column and select your report records into the table, then make your report based on the new table, that now includes a "serial number"

HTH

Jon
Aug 3 '07 #3
ashutoshvyas
18 New Member
SQLServer has Identity fields that are basically auto-increment numerics. I don't know if Access has something like that, but if it does, then create a temporary table with an auto-increment column and select your report records into the table, then make your report based on the new table, that now includes a "serial number"

HTH

Jon
Thanks a lot, Jon. I will try this and very soon I will reply that it was possible to perform or not & it works or not.
Aug 5 '07 #4
ashutoshvyas
18 New Member
Thanks a lot, Jon. I will try this and very soon I will reply that it was possible to perform or not & it works or not.
dear all
i am pasting the code with errors, an effort to take this problem towards solution. If anyone can turn it into functionality, it will be a great help for me.


' I KNOW THIS CODE IS WITH ERRORS BUT I WANT TO MAKE IT ERROR FREE IF POSSIBLE
' SO THAT I CAN GENERATE A REPORT WHICH ACCEPTS DATE AS PARAMETER
' AND FILTER THAT RECORDS BY DATE AND STORES RESULTS IN TEMPORARY TABLE
' SO THAT RECORD COUNT CAN BE DONE AND THEN REPORT CAN BE GENERATED.

Private Sub Command1_Click( )
'The If block closes the recordset if it was previously open before
'running the parameterized query.

With DataEnvironment 1
If .rsCommand1.Sta te = adStateOpen Then
.rsCommand1.Clo se
End If

' This passes in the value entered into the TextBox.

.command1 CDate(text1.Tex t)

' This If block checks to determine if any records are returned
' by the parameter. Then it shows a report if records are returned.
' Or displays a Message Box if no records are returned.

If .rsCommand1.Rec ordCount > 0 Then
Set rptashu.DataSou rce = DataEnvironment 1

' code inserted to prepare a new table with record count

Dim i As Long
'Delete current data in A_Temp_Table
sql = "DELETE * FROM temptable"
Con.Excute sql

'select the data needed
sql = "SELECT * FROM dataenvironment 1" ' selecting all the fields
Set rs = Con.Excute(sql)
i = 1
While Not rs.EOF
'insert row for temporary table with serial column
sql = "INSERT INTO temptable (Serial,account _no,card_no,nam e,amount,paymen t_dat e,Second last Date,Sum Of amount) VALUES(" & i & "," & rs.Fields(1) & "," & rs.Fields(2) & "," & rs.Fields(3) & "," & rs.Fields(4) & "," & rs.Fields(5) & "," & rs.Fields(6) & "," & rs.Fields(7)
Con.Excute sql
rs.MoveNext
Wend
'now, showing Report with data load from temp table
' report shown by parameter paseed as date, and taking all the records from temp table filtered by date and with record count

rptashu.Show
Else
MsgBox "No Titles found"
End If
End With
End Sub
Aug 5 '07 #5

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

Similar topics

13
2732
by: | last post by:
From ASP I run a query using MIN(some_field/parameter) Now I need to pass this parameter to the query from ASP code How do I do that? Syntax like MIN( / ) does not work
3
16940
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can create a parameter query in a stored procedure, but how do I use the result set of a parameter query in a select query (in the same or another sp)? In short, if a select query contains a result table that is generated as a parameter query, how do I...
0
1098
by: Cady Steldyn | last post by:
I need to run a data report that will query an Access_Table that has the following Project info: My Form has a command_button with the following code: Private Sub Command1_Click() Set db = New Connection db.CursorLocation = adUseClient db.Open "PROVIDER=MSDataShape;Data
1
1865
by: Generale Cluster | last post by:
Hello, I need to extract the names of the employees which have not been active during the last 3 months from the following tables EMPLOYEES: employee_id name COOPERATIVE cooperative_id
6
5373
by: klove1209 | last post by:
Good afternoon, Can someone please tell me how I can return records from a query. I have text fields that I need to obtain, and have those necessary records sent to MS Word. I need to return the data that is in MainSectionLabel, MainLabel and SummaryTextBox. Here is what I have so far: Public Function gettbldata() Dim strSQL As String
3
1849
by: suresh_punniyakkodi | last post by:
Hello to all, How to pass SQL Query to DataReport at Runtime... Please, Any body help for this Question... Regards, Suresh...
1
1296
by: ragavan | last post by:
hi, i have some problem in my project.i have membername and member detail.nw i want to sortlist member details instead from city.how can i derive from datareport when select a city name from textbox. plz tell me
3
2645
by: RAM28079 | last post by:
i created a dataenvironment command with 2 query parameters which were received from the user through form. one for numeric datatype and another for a string datatype. when i call the report using the commnd it gives an error as.... parameter object is improperly defined.Inconsistent or incomplete information was provided with run time error no as 2147220992(80040200) i have defined them as numeric and string datatype in the parameter...
8
4630
by: DanicaDear | last post by:
I have something interesting...looking to see if anyone else has came across this. I have a query with parameter and and the query works beautifully every time. However, when I use the wizard to build a report, at the end of the wizard the report opens beautifully, asks for the 2 parameters, and displays results. Beautiful. Then, after closing the report and re-opening, the report promts me for a third, unwanted parameter. ...
0
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8617
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.