How do I Use Automation to run Access functions?

T

TC

Sorry, none of that will work, at all.

What are you actually trying to do? Are you trying to find the current user
of the database?

TC
 
T

TC

I'm not sure, but try this: (I don't have VB)

dim oAccess as object
set oAccess = createobject ("access.application")
oAccess.opencurrentdatabase (...) ' <- your file here.
oAccess.Run "GetUserID"
oAccess.closecurrentdatabase
oAccess.quit
set Access = nothing

Put a temporary msgbox in your GetUserID function so you can tell if it is
being called. Make sure the function is declared as Public. If this works
(ie. you see the messagebox), then, see if the following change will give
you the value returned by the function:

print oAccess.Run("GetUserID")

No guarantees, tho!

HTH,
TC
 
J

Jcasual

I am trying to call a function in access from vb, but I am
not sure how to return the value I need.

Here's just a rough draft of what I want to do (I am kind
of new at this automation stuff)..

Private Sub cmdGetID_Click()


Dim acc As New Access.Application

acc.Visible = False

Dim ACCUser As Recordset

acc.OpenCurrentDatabase dbStr

Set ACCUser = acc.DoCmd.OpenModule(, "GetUSerID")

accData.Text = ACCUser!Userid

acc.CloseCurrentDatabase

Set acc = Nothing


Any Suggestions?
 
J

Jcasual

I'm trying to pull a value from my access table based on
paremeters in my vb form by running a function I have in
access. (without creating a recordset.)

I want just maybe I could simulate a storeprocedure in
access.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top