 |
(Pages: 1 2 ) |
 |
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Using Access 2000 files with VB6
It is very possible that someone else has already discussed this topic , so in this case , please quide to that topic in order not to bother you again . In any case , here's what i wonder about : Is it possible to use Access 2000 ( or later ) files with VB6 ? You see , when I determine the field property of a data base ( on the Data control ) i get an error that sais something like "Unknown data base type" . I have checked the "Access 10" option in the References dialog box , but the problem is still there . . .
|
|
06-02-2005 at 09:47 PM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: Using Access 2000 files with VB6
It seems to me that you are using DAO 3.51 object library, and If I am not wrong. it supports only up to Access 97' version. So, reference to DAO 3.6 object library. And you dont need Access object library (you are refrencing to) in order to work with data from access database.
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
07-02-2005 at 11:26 AM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
Well i unchecked the reference to DAO 3.51 ( you are right , it only adds support up to Acces 97 ) and referenced to DAO 3.6 Object Library , but I still get the same error message ( unrecognized data type ) .
|
|
07-02-2005 at 06:45 PM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: Using Access 2000 files with VB6
Well, you dont post any code, and how do you connect to database. If you are using DAO data control, then you cant open 2K and newer versions with it, since DAO data control uses 3.51 jet engine by default. So, you need to do it through code
' reference to MS DAO 3.6 Object Library needed
Dim db As Database, rs As Recordset
Set db = DBEngine.OpenDatabase("c:\dbname.mdb") |
Maybe you should reconsider using ADO instead of DAO, its a tehnology that MS advice to be used.
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
07-02-2005 at 11:38 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
I am not using any code at all , i just change the "RecordSourse" property of the Data control on my Form . Well , I have downloaded Jet 4 , but I wasafraid to install it . However , if you insist , then I'll do it . . .
|
|
08-02-2005 at 09:38 PM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: Using Access 2000 files with VB6
I will repeat myself again. You CANT use DAO control with Access 2000, it doesnt support it. And since you have reference to Microsoft DAO object library version 3.6, then you already have Jet 4.0 installed.
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
09-02-2005 at 12:07 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
Well , eitherway , I canceled the Jet 4 installation , becouse it stood there processing for 5 minutes and still had not finished . . .
|
|
09-02-2005 at 07:23 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
OK , Goran , you provided me a code above and as far as i can understand ( i think that was quite easy even for a beginer like me ) you declared a DataBase variable and set to it a value ( an existing access file ) . Now , tell me please how can I reference that file to a Dat control and how can I set the RecordSet for that control too ? In case I am using the wrong control , please tell me ( you said that I should use ADO instead of DAO ) . Anyway , I apreciate your help up to now and thanks again .
|
|
09-02-2005 at 07:32 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
OK , Goran , you provided me a code above and as far as i can understand ( i think that was quite easy even for a beginer like me ) you declared a DataBase variable and set to it a value ( an existing access file ) . Now , tell me please how can I reference that file to a Dat control and how can I set the RecordSet for that control too ? In case I am using the wrong control , please tell me ( you said that I should use ADO instead of DAO ) . Anyway , I apreciate your help up to now and thanks again .
|
|
09-02-2005 at 07:33 PM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: Using Access 2000 files with VB6
Go to Project - Components (or CTRL+T) and select Microsoft ADO Data Control. This ADO data control is kind of similar to DAO data control. I personally dont use this data controls, I like to do it in code, and to know what is going on there. Search a little bit on ADO tutorial on net, so you can understand the difference.
Use Provider=Microsoft.Jet.OLeDB.4.0 as connection string for ADO data control.
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
09-02-2005 at 09:34 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
I am sorry I didn't reply for long , but I was sick .
Ok , thanks . I found the ADO control and I also managed to attach an Access 2000 file to it ! However , I no longer can bind a DBGrid control to the DAO control ( while in the past I could connect the DBGrid control to a DAO data control ) . Is there any other grid like control which I can connect to a ADO control ? I tried the Microsoft Flex Grid control but it also requires DAO data controls . . .
|
|
20-02-2005 at 01:04 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
I am a happy man !
[Edited by iliekater on 20-02-2005 at 05:30 AM GMT]
|
|
20-02-2005 at 01:28 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
Well . . . I am not a happy man any more . . . I set a password in the Access 2000 file , but despite the fact that I set the same password at the ADO control , i cannot access that file . . . Maybe I didn't set the password where I should . I set as username "Admin" and as password my password . What am I doing wrong ?
|
|
20-02-2005 at 02:59 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
I have to say three things :
1) Youa are right , this SHOULD be respected . I feel so fool I didn't see the word "search" . . . .
2) Thank you once again for your your help .
3) I tried everything our friend yronium said at the link you provided but on each try I got an error message . Before I present the cases I tried , keep in mind that since it was not clear where should I insert the code ( to open a password protected Access file ) , I put in the "Form" "Initialize" event section . Here's what happened on every case :
a) case 1 : The code provided was :
Private Sub Form_Initialize()
Set ADOCon = New ADODB.Connection
ADOCon.Provider = "Microsoft.Jet.OLEDB.4.0"
ADOCon.ConnectionString = "Data Source=D:\Factory\Pixis\Data Bases\Acces 2000 format\Pixis.mdb"
ADOCon.Open , , , "mypassword"
End Sub
I got the following error message :
"Type missmatch"
and the editor indicated me that the error was on this line :
ADOCon.Open , , , "mypassword"
b) case 2 : The code provided was :
Private Sub Form_Initialize()
Set ADOCon = New ADODB.Connection
ADOCon.Provider = "Microsoft.Jet.OLEDB.4.0"
ADOCon.ConnectionString = "Data Source=D:\Factory\Pixis\Data Bases\Acces 2000 format\Pixis.mdb"
ADOCon.Properties("Jet OLEDB: Database Password") = "mypassword"
ADOCon.Open
End Sub
I got the following error message :
"Item cannot be found in the collectioncorresponding to the requested name or ordinal."
and the editor indicated me that the error was on this line :
ADOCon.Properties("Jet OLEDB: Database Password") = "mypassword"
c) case 3 : The code provided was :
Private Sub Form_Initialize()
Set ADOCon = New ADODB.Connection
ADOCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "D:\Factory\Pixis\Data Bases\Acces 2000 format\Pixis.mdb" _
& ";Jet OLEDB: Database Password=" & "mypassword"
End Sub
I got the following error message :
"Could not find installable ISAM."
and the editor indicated me that the error was on this line :
ADOCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "D:\Factory\Pixis\Data Bases\Acces 2000 format\Pixis.mdb" _
& ";Jet OLEDB: Database Password=" & "mypasword"
|
|
21-02-2005 at 10:06 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Re: Using Access 2000 files with VB6
I am so sorry to say it . . . but there's still a problem . . .
I removed the 'space' , but when my form is called ( the one that has a Data Grid control on it ) I get a new error message that sais : "Not a valid password" . . . !
I checked the password in the Access file and it's the one I set in the VB project as well . I even thaought that the meaning of "invalid password" not really ment that the word was not the right one but maybe the way I provided it was not the correct one , so I tried to provide the pasword without the " caracters , but the problem it's still there . . .
I think I am damned not to use Access 2000 files in my VB projects . . .
|
|
22-02-2005 at 08:25 PM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: Using Access 2000 files with VB6
Dont put single quotes ' ' around password, and remember that password is case sensitive. There is no reason why it shouldnt work.
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
22-02-2005 at 09:58 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
I am not lying . . . I used the correct password ( no capitals or caracters on other languages ) and I did not use single quotes . . .
|
|
22-02-2005 at 10:26 PM |
|
|
yronium Level: Moderator

 Registered: 14-04-2002 Posts: 907
|
Re: Using Access 2000 files with VB6
(I'm back, got me a brand new ADSL router, so I can access the web again from home. )
First, I had a check to the code I posted ago, and I found an ambiguous point: in a book of mine the declaration to use is: "Provider=Microsoft Jet 4.0 OLE DB Provider". So you can try using this form instead, though the declaration I posted belongs from some working code of mine.
Then, about the password db...
It's right, I put a space into the ";Jet OLEDB: Database Password=" property in order to avoid it to be converted into a smiley (thanks, Goran). The rest of the property declaration is exactly as it's needed, including semicolon before, the double colon, and the capitals positions. The equal sign isn't rounded by spaces, neither before nor after.
Remember that the Database Password is a connection string's property, so you have to build the string before using it. Following I post some working code from a project of mine:
Option Explicit
Dim cn As ADODB.Connection
Private Sub Form_Load()
Dim cns As String
cns = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\1.Dati\Sviluppo\VB6\Action\Banner\Ceralacca.xdb;Jet OLEDB atabase Password=sylvia;Mode=ReadWrite|Share Deny None;Persist Security Info=False"
Set cn = New ADODB.Connection
cn.Open cns
[... some other code...]
End Sub | The smiley has to be intended as ":" & "D". The Ceralacca.xdb file is a normal .mdb, but I renamed it (it works anyway, as MSJet doesn't care the file extension).
I suggest you to build the entire connection string into a variable, and then check it into the Immediate window by the Debug.Print instruction, before attempting to open the connection. You'll probably find the mistake.
Finally, about the "Installable ISAM" error, have a look on this post too.
Hope it helps
____________________________
Real Programmer can count up to 1024 on his fingers
|
|
23-02-2005 at 02:07 AM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: Using Access 2000 files with VB6
Ilekater, to make it very simple: If you have set database password in Tools - Security - Set Database password option, and you are supplying the right passowrd it must work. The last option would be something is wrong with ADO library, so you should download/reinstall newets version of MDAC from Microsoft site.
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
23-02-2005 at 11:08 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
OK , I am off to download that MDAC , whatever it is .
|
|
23-02-2005 at 11:12 PM |
|
|
iliekater Level: Master
 Registered: 04-02-2005 Posts: 122
|
Problem with the TUB Control
Well , as it sais on page
http://support.microsoft.com/default.aspx?scid=kb;en-us;842280
I don't have to download the latest version becouse it is includede in WinXP ( which I run ) . It only offers support for 64-bits .
Oh well, I'll keep on searching . . . I have to find what's wrong .
|
|
23-02-2005 at 11:21 PM |
|
|
Goran Level: Moderator
 Registered: 16-05-2002 Posts: 1681
|
Re: Using Access 2000 files with VB6
Dont you worry about XP, just download and install it from below address.
MDAC
____________________________
If you find the answer helpful, please mark this topic as solved.
|
|
24-02-2005 at 12:01 AM |
|
|
|
|
 |
 |