Access VBADiscuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
I am a newbie here but enjoying working with Access very much. My problem is not with coding (yet!) but with referencing "Microsoft Common Dialog Control V.6" I hope I explain this right? From "Access 2003 VBA Programmers Reference I have the following code to open a Word doc:
Private Sub cmdGoodFaithEstimate_Click()
Dim objWordApp As Word.Application
Dim objword As Word.Document
Dim strFilePath As String
Me.cmdlg.dialogtitle = "Choose File Name and Location"
Me.cmdlg.showopen
strFilePath = Me.cmdlg.FileName
DoCmd.OutputTo acOutputReport, "samples", acFormatRTF, strFilePath
Set objWordApp = CreateObject("word.application")
Set objword = objWordApp.Documents.Open(strFilePath)
' Make Word Visable
objword.Application.Visible = True
Set objword = Nothing
Set objWordApp = Nothing
'instantiate the new object as a word object
Set objword = GetObject("M:\MLa Databases\GoodFaith.doc", "Word.Application")
However the "cmdlg" throws out a compile error. If I understand correcty I should reference the object in VBA but its NOT showing up in to check. In Access it shows up as an Active X control, but registering there has no effect. Is this an error in VBA and can I fix it? I have tried most things suggested on the net. with no results.
Thanks in advance:)