How can i open acces file using a command button in vb. What should b da reference? what should b da code?
Same question for opening pdf file. help me plz.

Recommended Answers

All 4 Replies

Try this and let me know if it worked...

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
strDir = "<your files Directory>"
strFile = "<your filename>.pdf"
ShellExecute 0, "OPEN", strDir & strFile, "", strDir, 1
End Sub

Yo, Bro!!! Thanks again. It works very well. Good job. Dont forget to help me in next time.....

glad to help!

Heading Here
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.