borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

(Pages: Next Page 1 2 ) Print This Topic
Previous Topic (DATABASES & VB.NET)Next Topic (SQL statement from today to next day) New Topic New Poll Post Reply
AndreaVB Forum : Database : Using Access 2000 files with VB6
Poster Message
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122

icon 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
View Profile Send Email to User Show All Posts | Quote Reply
BRMC
Level: VB Lord


Registered: 28-11-2003
Posts: 210
icon Re: Using Access 2000 files with VB6

Hi,

but u create a connection to the db?
Take a look here

and here.

Bye

p.s. the references sholud be at microsoft activex data object x.x



[Edited by BRMC on 07-02-2005 at 09:36 AM GMT]

____________________________
I don't mind not going to heaven
As long as they've got cigarettes
in hell

07-02-2005 at 08:35 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
GeoffS
Level: VB Lord


Registered: 29-09-2004
Posts: 536
icon Re: Using Access 2000 files with VB6

Hi,
I think you may find that it is the Reference at fault. Access 10 is for Access XP (2002) - Access 2000 is Access 9.
Also, I think you will find that Jet Version 4 is required, it certainly is for Access XP.


[Edited by GeoffS on 08-02-2005 at 09:25 AM GMT]

____________________________
multi-tasking - the ability to hang more than one app. at the same time.

08-02-2005 at 09:23 AM
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
GeoffS
Level: VB Lord


Registered: 29-09-2004
Posts: 536
icon Re: Using Access 2000 files with VB6

Don't be afraid. Jet 4 is backward compatible so anything that works on 3.5 will be OK. But anyway, it will not overwrite Jet 3.5, that will still be there for any apps. that have a reference to it.


____________________________
multi-tasking - the ability to hang more than one app. at the same time.

09-02-2005 at 10:02 AM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon Problem with the TUB Control

Ok , I found it by myshelf ! I just have to stop using any Bind controls ! I can do the same think with the Data Grid Control ( not the Data Bind Grid Control ) .     

[Edited by iliekater on 20-02-2005 at 05:29 AM GMT]

20-02-2005 at 01:27 PM
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Using Access 2000 files with VB6

http://www.andreavb.com/forum/viewtopic.php?TopicID=4125&page=0#13903

http://www.andreavb.com/forum/viewtopic.php?TopicID=3976

Always try to find the answer first on the forum. You have a search option, you just needed to type database password in search textbox. If some question is asked many times, you might not get the answer, becasue it was already supplied several times.

____________________________
If you find the answer helpful, please mark this topic as solved.

20-02-2005 at 05:53 PM
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon Re: Using Access 2000 files with VB6

number 2) and 3) should work, with small change: there is a SPACE in Yroniums post that shouldnt exist:

[Jet OleDB:][SPACE][Database password]

This [SPACE] shouldnt exist. The reason Yronium put this space is because : and D when together result in    , like it can be seen in the first topic I gave you to look at, there I didnt put a space betwen and the result was this smiley   . So, remove this space in code, and no isam error will occur.

[Edited by Goran on 22-02-2005 at 12:44 AM GMT]

____________________________
If you find the answer helpful, please mark this topic as solved.

21-02-2005 at 11:38 PM
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 907
icon 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 OLEDBatabase 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon Problem with the TUB Control

I don't know what to say . . .
I still get the same error : "Not a valid password" . . .
Here's the I used :

Private Sub Form_Initialize()
Dim cn As ADODB.Connection
Dim cns As String
cns = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Factory\Pixis\Data Bases\Acces 2000 format\Pixis.mdb;Jet OLEDBatabase Password=MyPass;Mode=ReadWrite|Share Deny None;Persist Security Info=False"
Set cn = New ADODB.Connection
cn.Open cns
End Sub

If I use a password variable , instead of directly inserted the the password , I still get a message that sais "Not a valid password" , but this time it also perpresentts an error code .

23-02-2005 at 09:12 PM
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon Problem with the TUB Control

OK , I am off to download that MDAC , whatever it is .

23-02-2005 at 11:12 PM
View Profile Send Email to User Show All Posts | Quote Reply
iliekater
Level: Master

Registered: 04-02-2005
Posts: 122
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
Goran
Level: Moderator

Registered: 16-05-2002
Posts: 1681
icon 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
View Profile Send Email to User Show All Posts | Quote Reply
yronium
Level: Moderator


Registered: 14-04-2002
Posts: 907
icon Re: Using Access 2000 files with VB6

... if we must die, let's have a great death!

Try to do another attempt: create a new .mdb and set it a password. Then try opening it both by Access and by VB. If Access fails, it's due to Access' creation procedure (or maybe to XP); if only VB doesn't work, is an ADO/MDAC problem.
The only other thing that jumps in my mind is about some obscure XP privileges-management question, so in this case you shouldn't be able to open any .mdb you try to.

____________________________
Real Programmer can count up to 1024 on his fingers

24-02-2005 at 08:15 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Using Access 2000 files with VB6
Previous Topic (DATABASES & VB.NET)Next Topic (SQL statement from today to next day) New Topic New Poll Post Reply
(Pages: Next Page 1 2 )
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder