LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default how to call Access function&module in Excel VBA??

I have a question for how to call Access procedure/Function in Excel VBA?

Now I have Access, And I define a simple subform for test

data_pool.mdb
Sub test1()
Dim conDatabase As ADODB.Connection
Set conDatabase = Application.CurrentProject.Connection

Dim SQL As String
SQL = "update country set scale = scale + 1 where country = ""dd"" "
conDatabase.Execute (SQL)
'conDatabase.CommitTrans
'Call table_conversion

End Sub

right now I wanna call the test1() in my Excel file
(add Microsoft Access 10 library in reference)

myExl.xls

Sub Button36_Click()
'Dim cmd As ADODB.Command
'Dim conn As ADODB.Connection

Dim accessObj As Object
Dim ac As Access.Application
Dim path As String

path = ActiveWorkbook.path
path = path & "\data_pool.mdb"
Set accessObj = GetObject(path) ', "Access.Application")
Set ac = accessObj.Application

ac.Run test1
'accessObj.Application.Visible = True

'accessObj.Application.Run Module1.test1

End Sub

I can open this Access in the above code, but I can not run the test1() function here.

anyone can help me out, thanks a lot!!

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
call Module from MS Excel Object - Probably very easy VB questions Kevin Excel Discussion (Misc queries) 4 January 4th 08 02:32 AM
macro in excel to call a access module to run. [email protected] Excel Discussion (Misc queries) 0 April 23rd 07 08:59 PM
to call procedure in a worksheet in a module CAPTGNVR Excel Discussion (Misc queries) 4 January 30th 07 09:39 PM
Access Module coded converted to Excel Function Adam Excel Discussion (Misc queries) 1 December 23rd 04 02:48 PM
Call Private Function from ThisWorkbook module Beto[_3_] Excel Programming 3 February 25th 04 01:36 PM


All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"