home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1857
Discussions: 188,398, Posts: 2,243,595, Members: 232,628
Old January 20th, 2002, 12:20 PM   Digg it!   #1 (permalink)
Ultimate Member
 
korgul's Avatar
 
Join Date: Oct 2001
Location: York, PA.
Posts: 1,569
Unhappy
Problem with Access 2000 and VB 6

I am trying to create a VB program that will access a MS office 2000 Access database. I keep getting the error that the database is unrecognized.

This brings me to my question, Is VB 6 and Office 2000 compatible or am I doing something wrong? I know that the database is ok since I have gone into it since getting the error.


korgul

korgul is offline   Reply With Quote
Old January 20th, 2002, 12:32 PM     #2 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Hillsborough, NJ
Posts: 928
Send a message via AIM to JimG
Ok, how are you going about doing this?
I started VB 6, created a new program (exe) using the Wizard and when it asked if I wanted to create a form based on tables/queries, I said yes. Running that part of the wizard, I attempted to load one of my database projects. At that point I got this error: "Unrecognizable database format E:\xxx\DummyTest.mdb" Is this the same error you're getting?
I think the problem could be ODBC drivers. I thought Access 2000 was comptabile with VB 6, but maybe not 100%. Going to play with the ODBC parts now.

edit - You are not alone in this: http://www.techimo.com/forum/t8091.html


Last edited by JimG : January 20th, 2002 at 12:34 PM.
JimG is offline   Reply With Quote
Old January 20th, 2002, 12:41 PM     #3 (permalink)
Ultimate Member
 
korgul's Avatar
 
Join Date: Oct 2001
Location: York, PA.
Posts: 1,569
Yep that is the same error.

I thought I saw something before but could not find it. Thanks for the link.

I was creating an .exe from scratch and adding the database with the data access. You will have to excuse me on the terminolgy i am new to VB.
I had a class on it when I was in school but that was lmost 2 years ago.

korgul

korgul is offline   Reply With Quote
Old January 20th, 2002, 12:53 PM     #4 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Hillsborough, NJ
Posts: 928
Send a message via AIM to JimG
That's ok, I'm self taught in VB and VBA. My VB knowledge is limited with Access. I usually code with VB for HMI (human machine interface) applications. I'm much better in VBA with Access.
JimG is offline   Reply With Quote
Old January 20th, 2002, 01:14 PM     #5 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Hillsborough, NJ
Posts: 928
Send a message via AIM to JimG
Korgul,

Check out that other thread: http://www.techimo.com/forum/t8091.html
I got it to work by converting the db back to Access 97, then make sure the Active X 2.0 data thing (sorry, can't remember the exact name) is checked. Got past that error with this. Good luck!
JimG is offline   Reply With Quote
Old January 20th, 2002, 05:46 PM     #6 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,026
Microsoft ActiveX Data Objects 2.0 ?


yeah if you're using VB with Access, ADO is the best way to do it. Dont bother with RDO and DAO they are outdated and probably wont be supported much longer.

Fairly easy as well, hardest part is setting up the connection junk.

the ADO control on a form is easy to do, but not good if you want things to be a little more dynamic (typically this is my case)
vass0922 is offline   Reply With Quote
Old January 21st, 2002, 03:34 PM     #7 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Hillsborough, NJ
Posts: 928
Send a message via AIM to JimG
vass,
Yeah, you're right, that's it ... I had all those words floating in my head, but they were not forming the correct name.
Thanks.
JimG is offline   Reply With Quote
Old January 21st, 2002, 03:41 PM     #8 (permalink)
Kawaru wa yo!
 
Whir's Avatar
 
Join Date: Oct 2001
Location: Kingsford, MI
Posts: 16,137
Blog Entries: 7
If you're really saavy and your database has a lot of tables and queries, you can create an ADO Data Environment. It cuts down the hard coding if you've got say, 40 queries and ten tables. The query builder in VB6 is pretty decent, at least as good as Access (heck, might be the same one). I used the ADO-DE for an app that took form data, put it in the database, then read the entire database out and created a formatted text file for the MUD I imp on. Not the best way to go for high end dbase stuff, but if you're using Access, you're not using high end dbase stuff anyway.

-Whir
Whir is online now   Reply With Quote
Old January 21st, 2002, 04:12 PM     #9 (permalink)
Senior Member
 
PonzSpyder's Avatar
 
Join Date: Oct 2001
Location: New Jersey
Posts: 707
Send a message via AIM to PonzSpyder Send a message via Yahoo to PonzSpyder
Quote:
The query builder in VB6 is pretty decent
Hmmm... never used it, I'll have to check it out

I used something like this for VB6 to Access 2000:

Code:
Public DataSource As Variant
Public CN As New ADODB.Connection
DataSource = "Data Source=C:\Temp\Database.mdb"
CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& DataSource & ";Mode=Read;Persist Security Info=False"
CN.Open
I think thats what it was, not sure though since it was a while ago and I dont have the current version of the code with me ATM.
__________________
"It's only after we've lost everything that we're free to do anything"

www.rjponzio.com
PonzSpyder is offline   Reply With Quote
Old January 21st, 2002, 05:37 PM     #10 (permalink)
Ultimate Member
 
Join Date: Oct 2001
Posts: 21,026
ponz, thats how I do it as well

Much more flexible if you want to be able to easily switch back and forth between a test DB, and a production DB.

Another solution (sorry lol) is using a UDL file. (if you have VB installed) you can right click and create a UDL file, if its not available create a empty text file and change the extension to .UDL if the icon changes it means you have the right software installed. I can't remember how to get the properties out of it, but I could find out if need be. Its been awhile

But you can double click it, and set all the properties for the connection this way. It worked great for us at my old job... we had a multi tier app and if we wanted ALL the clients to change databases (for an upgrade or whatever) we would just change the UDL on teh server and they'd change databases ) When the app asked for a connection the connection class asked the UDL where to go!

I've never used the DE at all... I tend to either create the sql in embedded sql
ie.
sSQL = " SELECT Column1, Column2"
sSQL = SQL & " FROM TableName"
sSQL = SQL & " WHERE Column1 = " & SomeIntegerVar
etc etc.

This way its not entirely hardcoded because as you concat the sql, you can throw in a variable
vass0922 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2905)
Unarmed man on his stomach shot by .. (6)
Misery Loves Company... (2144)
New Build ( Finally ) (6)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (444)
Upgrading RAM (6)
Recent Discussions
Partition Magic 7.0 (Unallocate.. (17)
For cheap price and good qualit.. (1)
Left 4 Dead Small Freezes (3)
RCA 52Inch HDTV wont turn on (4)
wishin i could edit my aol prof.. (0)
Sporadic internet connectivity (2)
Assassins Creed PC Problems (40)
I think my PSU is dieing (1)
building a gaming computer, inp.. (0)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 03:29 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28