View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Controlling Access from Excel

do you have

.OpenCurrentDatabase . . .

with a period in front of OpencurrentDatabase?

--
Regards,
Tom Ogilvy

"Jim May" wrote in message
news:%_odf.11888$0l5.5789@dukeread06...
Gary nice code; I'm trying it out here
and am currently getting:
Compile Error
Sub Function not defined
where
OpenCurrentDatabase << is highlighted
What can/should I do to move forward here?

TIA,
Jim

"Gary L Brown"
wrote in message
news:Gary.L.Brown.1ycfxa_1131731409.0439@excelforu m-nospam.com...

Try something like...

Sub OpenAccess()
Dim objAccess As Object

On Error GoTo err_Sub

Set objAccess = CreateObject("Access.Application")

With objAccess
OpenCurrentDatabase filepath:="G:\Temp\ReestablishLinks.mdb"
Visible = True
DoCmd.RunSQL "Select..."
End With

MsgBox ""



exit_Sub:
On Error Resume Next
Set objAccess = Nothing
Exit Sub

err_Sub:
Debug.Print "Error: " & Err.Number & " - " & Err.Description
GoTo exit_Sub

End Sub
---------------------
where...
DoCmd.RunSQL "Select..."
is fine as long as you are doing an action make-table query.

HTH,
Gary Brown



--
Gary L Brown
------------------------------------------------------------------------
Gary L Brown's Profile:
http://www.excelforum.com/member.php...o&userid=28563
View this thread:

http://www.excelforum.com/showthread...hreadid=484324