Open a Access Dbase File

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
Hi all, what I am trying to do is open a dbase file. I have no problem opening a workbook, but how can I change my sub to open a Acces file (labor dbase.mbd)
I know the workbooks.open is wrong but dont know what to substitute, and can it also open one of the forms within the dbase file at the same time. Thx Dan

FrmLbedit.Hide
ChDir "C:Unit PriceDbase"
Workbooks.Open Filename:="C:Unit PriceDocumentsCharges.xls"
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Sorry not trying to open a xls,
FrmLbedit.Hide
ChDir "C:\Unit Price\Dbase\"
Workbooks.Open Filename:="C:\Unit Price\Dbase\Labor Dbase.mbd"
But The Workbooks.Open Is not correct. Anyont know what it should be ?
 
Upvote 0
Hi dantb.
You might want to go into VBA and familiarize yourself with DAO or ADO.
DAO is probably good enough for what you are looking for. Is easy to use.
Look up DAO or Data Access Objects in help.
Too big a subject to go into here.
Either that and/or SQL.
I am weak when it comes to databases but have poked around alittle with DAO.
Good Luck!
Tom
 
Upvote 0
Ok thx Tom, I didnt know that trying to open a dbase file from excel was that intence. I will go and try and learn , thx again for your help, and Have a good evening. Thx again Dan
 
Upvote 0
Hi Dantb,

First, in XL VBE: Tools, References, and tick checkbox for whichever MS Access Library you need eg "Micosoft Access 9.0 Object Library" if you have Access 2000, then try this..

Sub OpenAccessDB()

Dim oApp As New Access.Application
Dim strDB As String
Dim stFormName As String

strDB ="C:\UnitPrice\Dbase\LaborDbase.mbd"
'I think that was your path, but check !
stFormName = "**Form Name you want in here**"


With oApp
.OpenCurrentDatabase strDB
.DoCmd.OpenForm stFormName
.Visible = True
.UserControl = True
End With

End Sub

(Not really sure if that is what you are after but hope it helps a bit !)
 
Upvote 0
Hey Dan.
Don't be discouraged with DAO.
Very easy to use. If all you are needing are values from a database, you will have it doing exactly what you want with a minimum amount of code.
Tom
 
Upvote 0
Hi Dan/Tom,

Oops ! I really didn't want to discourage the use of DAO.It is extremely useful and has methods which ADO doesn't have (yet). It can't open a database or display a form, however, it isn't really meant for that !

Tom is quite correct in that you could very easily use it to replace the code behind the controls on the form that you want to show, depending on what the form does.

Sorry, I thought (probably quite wrongly) that you just wanted a shortcut to a data entry form !
 
Upvote 0
No Problem sutjh.
I'm not too sure what Dan is after myself?
Maybe Dan isn't either?
Joking Dan!
Tom
 
Upvote 0
I think Tom Hit it on the head, just trying to get the dern dbase to open, then I can add the code to access the form. Thx Tom
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,037
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top