Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO, VB6, Access 2000, DataReport...I need some help using these?

Status
Not open for further replies.

Webrookie

Programmer
May 18, 2000
112
US
Ok, so here I am, writing a simple VB program in my free time.&nbsp;&nbsp;I'm hitting an Access 2000 database with DAO 3.6.&nbsp;&nbsp;I then decide, &quot;ok, I think I'll add a reporting feature.&quot;&nbsp;&nbsp;Well, from what I can gather from MSDN CD, the only way to programmitcally change a report is using ADO.&nbsp;&nbsp;I'm like, ok, fine, whatever.<br><br>First question:<br><br>How do I setup an ADO connection to an Access 2000 object?<br>&nbsp;&nbsp;Currently, I have the following:<br><br>Dim db As New ADODB.Connection<br>Dim rs As New ADODB.Recordset<br><br>db.ConnectionString = &quot;provider=Microsoft Access Driver(*.mdb) ;uid=;pwd=;database=files.mdb&quot;<br>db.Open<br><br>'Note the ConnectionString fits on one line in my code<br>'End Code<br><br>After I can connect to my database, I would like to create reports based on what is selected on my form...a dynamic sql statement if you will.&nbsp;&nbsp;<br><br>So right now,&nbsp;&nbsp;I have this: (follows the previous code)<br><br>SQL = &quot;select * from files where type = '&quot; & typecom & &quot;' order by '&quot; & ord & &quot;'&quot;<br>rs.Open SQL, db, adOpenKeyset, adLockPessimistic<br><br>'Note the SQL assignment line fits on one line in my code.<br>'End Code<br><br>Then I want to manipuate the data report accordingly, which is where I lack any knowhow, so any information regarding this would be greatly appreciated.<br><br>Thanks in advance
 
check out my ADO FAQ in the VB forum <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Hey, I checked out your ADO FAQ.<br><br>Is it possible to use access2k database without a DSN entry?<br>I would like to avoid that as much as possible...
 
you could access it the same way you did above, shouldnt make much difference, a connection string is a connection string. once you get yout Connection open, the rest is the same. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Ok, <b>I got it to work</b>.&nbsp;&nbsp;I basically pulled some code from one of my ASP webpages that accessed an access database.<br><br>db.Open &quot;driver=Microsoft Access Driver (*.mdb); dbq=&quot; & App.path & &quot;\files.mdb&quot;<br><br>'On one line in VB<br>'End Code<br><br>Now, my next task, should I choose to accept it, is to dynamically create a report.&nbsp;&nbsp;I wonder if I should start a new thread for this.&nbsp;&nbsp;I'll post it in here, and if I don't get a response for a while, I'll start a new one...<br><br><b>Facts:</b><br><br>I have an ADO connection to a database.&nbsp;&nbsp;I have an ADO recordset that changes depending on user specifications. <br><br><b>Question:</b><br><br><i>How do I create a report on the fly from the recordset generated by the user?</i>
 
since your Thread Topic, seems generic enough around the situation, I would sugest keeping it into the same thread. Unfortunatly I would not know how to create a report through Access (but if you mean retreiving data from the database, then creating a report through your application, this shouldnt be too hard, just need some organizing of the data you get back) <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top