Medic 09-28-2000, 12:47 PM Is it just my imagination or does there seem to be NO INFORMATION on accessing a dbase file. I am writing a program that NEEDS to interface with a DBASE III file, that is unwrapped, and there is no information on the subject ANYWHERE! I know that microsoft does not personnally profit from these types of data files, but this shouldn't be the worlds best kept secret!!! I have THREE reference manuals, including one just for ADO, and have also searched the MSDN library, and the mickeysoft website for how to make a simple connection to a dbase file. I finally gave up and created an Access linked table to manipulate the dbase table. Seems dumb to me but... well guess what, it does not work that way either. Cant link to a linked table I guess. ALthough I can manipulate it direct in Access, when I try to open it in VB I get the error that VB cannot locate the IISAM drivers. Can anybody PLEEEAAASSE help me out with the connection string!
BillSoo 09-28-2000, 01:07 PM I use DAO and I connect to a DBIV database so my situation is not quite the same as yours...
Here is how I connect:
1) suppose my database is a bunch of .dbf files located in "c:data""
2) suppose I'm interested in one table - "xyz.dbf"
3) I'd connect like:
dim db as dao.database
dim rs as recordset
set db = DBEngine.Workspaces(0).OpenDatabase("c:data"
BillSoo 09-28-2000, 01:07 PM I use DAO and I connect to a DBIV database so my situation is not quite the same as yours...
Here is how I connect:
1) suppose my database is a bunch of .dbf files located in "c:data""
2) suppose I'm interested in one table - "xyz.dbf"
3) I'd connect like:
dim db as dao.database
dim rs as recordset
set db = DBEngine.Workspaces(0).OpenDatabase("c:data"
BillSoo 09-28-2000, 01:07 PM I use DAO and I connect to a DBIV database so my situation is not quite the same as yours...
Here is how I connect:
1) suppose my database is a bunch of .dbf files located in "c:data""
2) suppose I'm interested in one table - "xyz.dbf"
3) I'd connect like:
dim db as dao.database
dim rs as recordset
set db = DBEngine.Workspaces(0).OpenDatabase("c:data"
BillSoo 09-28-2000, 01:07 PM I use DAO and I connect to a DBIV database so my situation is not quite the same as yours...
Here is how I connect:
1) suppose my database is a bunch of .dbf files located in "c:data""
2) suppose I'm interested in one table - "xyz.dbf"
3) I'd connect like:
dim db as dao.database
dim rs as recordset
set db = DBEngine.Workspaces(0).OpenDatabase("c:data"
BillSoo 09-28-2000, 01:07 PM I use DAO and I connect to a DBIV database so my situation is not quite the same as yours...
Here is how I connect:
1) suppose my database is a bunch of .dbf files located in "c:data""
2) suppose I'm interested in one table - "xyz.dbf"
3) I'd connect like:
dim db as dao.database
dim rs as recordset
set db = DBEngine.Workspaces(0).OpenDatabase("c:data"
BillSoo 09-28-2000, 01:07 PM I use DAO and I connect to a DBIV database so my situation is not quite the same as yours...
Here is how I connect:
1) suppose my database is a bunch of .dbf files located in "c:data""
2) suppose I'm interested in one table - "xyz.dbf"
3) I'd connect like:
dim db as dao.database
dim rs as recordset
set db = DBEngine.Workspaces(0).OpenDatabase("c:data"
Medic 09-28-2000, 03:10 PM Thanks! You get the trophy icon award for the quickest reply I've ever received on this board!!! Still doesn't work though. :( I kept getting the "can't load ISAM driver" error on the first line, but found the problem to be "dBASE IV" not "dBASEIV". So on to the next line, which causes a "type mismatch error" which might make sense if I was trying to stuff an integer into a string but I don't even get that far! Any Ideas! The help file is useless, as it doesn't talk about the problem (BIIIG Surprise!). Please help with this issue as it will open so many opportunities! :)
Oh Yeah, the code would be helpful!
Private Sub Form_Load()
Dim db As dao.Database
Dim rs As Recordset
Set db = DBEngine.Workspaces(0).OpenDatabase("c:SA"
Medic 09-28-2000, 03:10 PM Thanks! You get the trophy icon award for the quickest reply I've ever received on this board!!! Still doesn't work though. :( I kept getting the "can't load ISAM driver" error on the first line, but found the problem to be "dBASE IV" not "dBASEIV". So on to the next line, which causes a "type mismatch error" which might make sense if I was trying to stuff an integer into a string but I don't even get that far! Any Ideas! The help file is useless, as it doesn't talk about the problem (BIIIG Surprise!). Please help with this issue as it will open so many opportunities! :)
Oh Yeah, the code would be helpful!
Private Sub Form_Load()
Dim db As dao.Database
Dim rs As Recordset
Set db = DBEngine.Workspaces(0).OpenDatabase("c:SA"
Medic 09-28-2000, 03:10 PM Thanks! You get the trophy icon award for the quickest reply I've ever received on this board!!! Still doesn't work though. :( I kept getting the "can't load ISAM driver" error on the first line, but found the problem to be "dBASE IV" not "dBASEIV". So on to the next line, which causes a "type mismatch error" which might make sense if I was trying to stuff an integer into a string but I don't even get that far! Any Ideas! The help file is useless, as it doesn't talk about the problem (BIIIG Surprise!). Please help with this issue as it will open so many opportunities! :)
Oh Yeah, the code would be helpful!
Private Sub Form_Load()
Dim db As dao.Database
Dim rs As Recordset
Set db = DBEngine.Workspaces(0).OpenDatabase("c:SA"
Medic 09-28-2000, 03:10 PM Thanks! You get the trophy icon award for the quickest reply I've ever received on this board!!! Still doesn't work though. :( I kept getting the "can't load ISAM driver" error on the first line, but found the problem to be "dBASE IV" not "dBASEIV". So on to the next line, which causes a "type mismatch error" which might make sense if I was trying to stuff an integer into a string but I don't even get that far! Any Ideas! The help file is useless, as it doesn't talk about the problem (BIIIG Surprise!). Please help with this issue as it will open so many opportunities! :)
Oh Yeah, the code would be helpful!
Private Sub Form_Load()
Dim db As dao.Database
Dim rs As Recordset
Set db = DBEngine.Workspaces(0).OpenDatabase("c:SA"
Medic 09-28-2000, 03:10 PM Thanks! You get the trophy icon award for the quickest reply I've ever received on this board!!! Still doesn't work though. :( I kept getting the "can't load ISAM driver" error on the first line, but found the problem to be "dBASE IV" not "dBASEIV". So on to the next line, which causes a "type mismatch error" which might make sense if I was trying to stuff an integer into a string but I don't even get that far! Any Ideas! The help file is useless, as it doesn't talk about the problem (BIIIG Surprise!). Please help with this issue as it will open so many opportunities! :)
Oh Yeah, the code would be helpful!
Private Sub Form_Load()
Dim db As dao.Database
Dim rs As Recordset
Set db = DBEngine.Workspaces(0).OpenDatabase("c:SA"
Medic 09-28-2000, 03:10 PM Thanks! You get the trophy icon award for the quickest reply I've ever received on this board!!! Still doesn't work though. :( I kept getting the "can't load ISAM driver" error on the first line, but found the problem to be "dBASE IV" not "dBASEIV". So on to the next line, which causes a "type mismatch error" which might make sense if I was trying to stuff an integer into a string but I don't even get that far! Any Ideas! The help file is useless, as it doesn't talk about the problem (BIIIG Surprise!). Please help with this issue as it will open so many opportunities! :)
Oh Yeah, the code would be helpful!
Private Sub Form_Load()
Dim db As dao.Database
Dim rs As Recordset
Set db = DBEngine.Workspaces(0).OpenDatabase("c:SA"
Rhoarke 09-28-2000, 04:43 PM greetings, medic. Try adding the file extension to your "Carrier" ie: Carrier.mdb or whatever. I'm no expert, but I got the same kind of error in my efforts to open a file for ADO. VB balked at "patient" but worked great w/ "patient.mdb" :) HTH
-r
BillSoo 09-28-2000, 04:47 PM Well....it looks like it should work....
Maybe double check that rs is the right type:
Dim rs as DAO.Recordset
just in case you have an ADO connection as default or something.
Maybe fill in the default fields of the OpenRecordset method:
set rs = db.OpenRecordset("Carrier",dbOpenDynaset,dbReadOnly) 'assuming it is read only of course...
If that doesn't work, zip the dbf and attach it to your post so I can look at it. If it is relatively small of course...
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
BillSoo 09-28-2000, 04:48 PM One other thing...
Didn't you state before that it was a DB III database? Maybe try dBase III instead of dBase IV?
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Medic 09-28-2000, 05:26 PM The Carrier.dbf file that I want to access is tiny. Just five records, and that's even a rarity. I tried the file extension firts of all, and all variations therof. Tried Dbase III dbase IV , everything. I can connect to this table from within Access using either III or IV. I will give you everything I've got here, including all code, and a bitmap of the problem area. I must admit I got really excited about the idea of entering in those values that are normally defualt, as I use ADO almost exclusively in my code. In reading up on it, though, I hear that to access dbase you should really use dao. I just wish there weren't two different code models to learn. (Yes I checked to see that I had a reference to DAO in my project. Nop porblem there.) I also am finding out, as I checked 6 other vb forums, that there are five other posts by people who cannot access a dBASE table in code, and have received no response. (Doesn't look good ... gulp). I can access this fine using the Data object in the toolbar, but it's just not feasible. It should not be so hard to fill a combo box! (and it isn't if you are using Access!) I tell ya... It's a conspiracy!
BillSoo 09-28-2000, 05:51 PM I tried your attachment but there were a number of forms missing. So I just rewrote it. I was able to communicate with your dbf file. I've attached my code to this post but here is a the quick version:
<PRE><CODE>
Option Explicit
Private Sub Form_Load()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = DBEngine.Workspaces(0).OpenDatabase("c:SA"
BillSoo 09-28-2000, 05:56 PM Looking at your original code, there were a number of errors. For instance, you declared rsCarrier and were using it but never set it to anything. You should have used rs instead. Also, there is no field in Carrier called Carrier. I changed that to CAR_NAME instead.
Finally, I don't know if it matters but I used DAO 3.6 instead of DAO 3.51 as you have. I also had no ADO references at all. See the attachment in my previous post.
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Medic 09-28-2000, 06:12 PM Hoooooraaay! Yup, that seemed to do the trick, although in looking at it I still can't discern the difference in your code posted on number 7 and mine posted earlier. WHo cares... It works! Yeah. My code was messsssy! Since the error was experienced on that specific line I didn't even mess with the rest, and you may have even seen a portion of code that was ADO and referred to an access table. I never throw out (delete) old code until I know the new code works! I have been trying to do this for six months, but have since decided to just use access, as I am developing a new program for my boss, who wrote his program in Clipper. Well, his program needed an add on feature that he could not do, so that's when I realized I HAD to get over this issue. You have solved SO MANY problems with this one working line of code... I can't thank you enough! I will try to post on the other six boards this code so others can move on with their lives too. KUDOS to you BILLSOO
BillSoo 09-28-2000, 06:35 PM Thanks, I'll try not to let it go to my head :)
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|