View Full Version : Open an Access File from an VB4 App.


Schott
03-30-2011, 10:33 AM
Hello,

I am having some problems with this VB code I have to modified.

It was supposed to be VERY simple. Just add a new buttom to the form that when clicked, opens a .mdb file.


I am not sure how I would do that. Both the VC code and the Access VBA macro are quite old and were created on Access '97 and VB 4.0.

I'm not sure of which References I should add to make it work nor am I sure about the code that calls the .mdb file.

What I was trying to do was to modify a snipet of code I found on the web, but it didnt work (the code called a Word .doc file).

It was something along these lines:


Private Sub cmdmemoria_Click()

Dim objWdApp As Word.Application
Dim objWdDoc As Word.Document
Dim objwdRange As Word.Range
Set objWdApp = New Word.Application

Set objWdDoc = objWdApp.Documents.Open(App.Path & "RelSupEspecial.dot")

objWdApp.Visible = True

End Sub


Could anyone adapt that code to open an Access file and tell me the references I need?


Thank you very much.