473,604 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to use array of controls in a data report ???

60 New Member
I am to make a data report in which I am going to display the records dynamically from the database.
No. of record depends on the users input.
How can I do this?
I think an array of controls can serve my purpose.
So how to add an array of controls in a data report ?
Aug 27 '07 #1
26 3845
hariharanmca
1,977 Top Contributor
I m to make a data report in which i m going to display the records dynamically from the database.
No. of record depends on the users input.
How i can do this.
I think array of controls can serve my purpose.
so how to add array of controls in a data report ??
1. You have to connect dataenvironment to the database.
2. Using command you have to place the fields in detail section on report.
3. No need to create control array.
Aug 27 '07 #2
vishwaskothari
60 New Member
1. You have to connect dataenvironment to the database.
2. Using command you have to place the fields in detail section on report.
3. No need to create control array.

Thank You Dear

But I am not using the data environment to generate the report.

So how can I proceed now?
Aug 27 '07 #3
hariharanmca
1,977 Top Contributor
Thank You Dear

But I am not using the data environment to generate the report.

So how can I proceed now?
Can not you explain Detail?

can you creat any Database connection without connection provider?
Aug 27 '07 #4
vishwaskothari
60 New Member
Can not you explain Detail?

can you creat any Database connection without connection provider?

Here is the source code that i am using for generating the Report




ConnString = "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=D:\feemg mt_oldver.mdb;" & _
"Persist Security Info=False"
Set con = New ADODB.Connectio n
con.ConnectionS tring = ConnString
con.Open ConnString

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "SELECT * from accounts where std_id= '" & txtSearchRoll.T ext & "';", con, adOpenStatic, adLockOptimisti c



Do While Not rs.EOF

With repSearchId

Set .DataSource = rs
.DataMember = rs.DataMember
.Sections("Sect ion1").Controls ("lblSno").Capt ion = "'" & sno & "'"
.Sections("Sect ion1").Controls ("lblId").Capti on = "'" & rs(0) & "'"
.Sections("Sect ion1").Controls ("lblname").Cap tion = "'" & rs1(1) & "'"
.Sections("Sect ion1").Controls ("lblDate").Cap tion = "'" & rs(1) & "'"

DoEvents
.Show
sno = sno + 1

End With

rs.MoveNext

Loop

now in this report i want to display the records that are present in the recordsource(rs ),
BUT
this source code is displaying only the first record present in the recordsource(rs ),

now what should i do to display all the records that are present in the recordsouce(rs) .

plz help


TIA
Aug 27 '07 #5
hariharanmca
1,977 Top Contributor
Here is the source code that i am using for generating the Report




ConnString = "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=D:\feemg mt_oldver.mdb;" & _
"Persist Security Info=False"
Set con = New ADODB.Connectio n
con.ConnectionS tring = ConnString
con.Open ConnString

Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "SELECT * from accounts where std_id= '" & txtSearchRoll.T ext & "';", con, adOpenStatic, adLockOptimisti c



Do While Not rs.EOF

With repSearchId

Set .DataSource = rs
.DataMember = rs.DataMember
.Sections("Sect ion1").Controls ("lblSno").Capt ion = "'" & sno & "'"
.Sections("Sect ion1").Controls ("lblId").Capti on = "'" & rs(0) & "'"
.Sections("Sect ion1").Controls ("lblname").Cap tion = "'" & rs1(1) & "'"
.Sections("Sect ion1").Controls ("lblDate").Cap tion = "'" & rs(1) & "'"

DoEvents
.Show
sno = sno + 1

End With

rs.MoveNext

Loop

now in this report i want to display the records that are present in the recordsource(rs ),
BUT
this source code is displaying only the first record present in the recordsource(rs ),

now what should i do to display all the records that are present in the recordsouce(rs) .

plz help


TIA
My suggestion is, why you are making things more complicated?
Just think if they have 10,000 record and 100 fields, will you place 10,000 X 100 controls in a report?
Aug 27 '07 #6
vishwaskothari
60 New Member
My suggestion is, why you are making things more complicated?
Just think if they have 10,000 record and 100 fields, will you place 10,000 X 100 controls in a report?
Thanks Mr. Hariharan,

Here in my case it is gauarnteed that no. of records will not be more than 10.

Anyway plz tell me the appropriate way of doing this.
and also plz tell how i can do this using data environment.


Is it possible or not to insert control array on a data report?

TIA
Aug 27 '07 #7
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

U may not need control array. Add A Data Environment, A Connection Object, Link to the Database, Add a Command object to Conn Obj, Now change the Command Text to SQL and give " Select * From MyTable:

No Add a Data Report to ur proj, And Place the Fields of Command Object in ur Data Report. In Run Time, Just Change the SQL Query of Command Object according to ur selection and Show teh DataRpeort..

REgards
Veena
Aug 27 '07 #8
hariharanmca
1,977 Top Contributor
Thanks Mr. Hariharan,

Here in my case it is gauarnteed that no. of records will not be more than 10.

Anyway plz tell me the appropriate way of doing this.
and also plz tell how i can do this using data environment.


Is it possible or not to insert control array on a data report?

TIA
Yes we can creat Control Array but, it is not the correct way to do.

1. Add data Environment in Components (OCX Reference) and in Designers TAB
2. Then Right click in your project explorer.
3. You Get ADD > Data Environment (Click and Add Data environment to you project).


In Data Environment
------------------------------
4. in Connection Right click and choose properties in dropdown menu.
5. Select your Connection provider MS Jet 4.0 OLEDB
6. Click Next and choos your Database in file dialog box
7. Click test connection. If success then your connection is over.


Is Your Back-end is MS Access?
Aug 27 '07 #9
vishwaskothari
60 New Member
Hi,

U may not need control array. Add A Data Environment, A Connection Object, Link to the Database, Add a Command object to Conn Obj, Now change the Command Text to SQL and give " Select * From MyTable:

No Add a Data Report to ur proj, And Place the Fields of Command Object in ur Data Report. In Run Time, Just Change the SQL Query of Command Object according to ur selection and Show teh DataRpeort..

REgards
Veena
Thanks Veena

plz tell me how to place the fields of command object in Data Report, and
how to change the SQL query of command object at run time
Aug 27 '07 #10

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

Similar topics

1
1691
by: Stinky Pete | last post by:
Hi, I've got a sub report that has been set to print down then across as the data is sorted in date order. This sub report displays and prints as per my design when dealt with as a stand alone report. However, when the sub report is embedded into the main report, the sub report will only show and print data when the main reports Can Grow controls for the detail section are set to Yes. I've tried all settings I can think of for the...
8
3504
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At the moment the printed output is usually going to Word. It's turning into an unholy mess, because I'm having to prepare umpteen different Word templates, and the queries that drive them, depending on what events a course has.
4
2337
by: John Tyce | last post by:
The problem that I am now having, involves refreshing controls. I have allot of text boxes, several combo boxes and grids. These controls are showing live data from an Oracle database. I have dates in a combo box in my tool bar that are associated with the particular report that the user is opening. When the user picks a different date all of the data in the controls should reload. I originally built an SDI application but needed my tool bar to...
4
9165
by: James N | last post by:
Here's the situation: I have 3 webforms in my project. Form 1 allows the user to select a type of report to generate. There are 2 possible type of reports, and therefore, Forms 2 and 3 are these two generated reports. When being generated, both reports will need to use the exact same data. The data are static strings and I plan to declare a global array in Form 1, so that Form 2 and 3 can share them. In other words, I don't want to be...
3
1048
by: Sheldon | last post by:
In versions of VB prior to .net, I was able to create in code an array of controls, such as for i = 1 to 10 Load Me.lblTest(i) Me.lblTest(i).top = me.lblTest(i-1).top - me.lblTest(i-1).height - 200 Me.lblTest(i).visible = true next i where lblTest(0) already exists on the form.
6
1930
by: Les Juby | last post by:
I need to extract records from a database subject to conditions and only thereafter give the users the choice of which fields to sort the results on. In this situation I can't write back to a temporary file and then select all from that file on the different sort orderings. I figured that the only way out would be to write to an array from the first recordset set creation. Then write the report to the screen from the array and users...
3
18046
by: gihope | last post by:
Can anyone tell me why I am not allowed to bind a two or multi dimensional array to GridView and possibly suggest how they would deal with similar scenarios? The array is simply a two dimensional monthly volume array: Extract from Report class: // Query all Messages Sent for a Given Month public string qVolumeByMonth() { string volumeByMonth = new string;
3
19277
by: Richard Hollenbeck | last post by:
Hello, In regular VB, I remember I could create a generic label (call it something like lblFieldNames) and copy it and paste it. VB would say that I already have an object by that name then ask me if I wanted to create an array. So I would end up with lblFieldNames(0) to lblFieldNames(n). Then I could cycle through the QueryDef and fill the captions of the labels with the correct field names. Is that possible in VBA, and more...
4
2192
by: Harry | last post by:
Hi Guys I dont really know how to do this: if there are a page of others, some data are embedded inside the data array like this: <script language="JavaScript" type="text/javascript"> <!-- var jsData = new Array(); jsData = {bowl:"I", year:1967, winner:"Packers", winScore:35, loser:"Chiefs", losScore:10}; jsData = {bowl:"II", year:1968, winner:"Packers", winScore:33,
0
7929
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8419
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
8409
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...
1
8065
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6739
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...
0
3907
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2434
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
1
1526
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1266
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.