![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 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" |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
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 ? |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
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 |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
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
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
I can hyperlink to the dbase (np), but was just trying to put it into vb
|
|
|
|
|
|
#6 |
|
New Member
Join Date: Mar 2002
Posts: 15
|
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 !) |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
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 |
|
|
|
|
|
#8 |
|
New Member
Join Date: Mar 2002
Posts: 15
|
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 ! |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
No Problem sutjh.
I'm not too sure what Dan is after myself? Maybe Dan isn't either? Joking Dan! Tom |
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Mar 2002
Location: Arkansas
Posts: 358
|
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
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|