VBA data connections within a function

Z

Zachariah

I'm lost in VBA land people! I'm attempting to do some
hands off table updating. I have a desktop shortcut
with "/x macStart" in the command-line.

This kicks off macro macStart which does a RunCode of
function TestOpenTable(), which resides in module
modTestOpen.

The idea is that Access will open automatically and run
the code in my function.

That theory works. The problem is when the module runs the
function's code:

Function TestOpenTable()

Dim dbstestimportdb As Database
Dim rsCredRepInfo As Recordset
Dim rsEDISample As Recordset

Set dbstestimportdb = OpenDatabase("testimportdb.mdb")
Set rsEDISample = dbsTest.OpenRecordset("tblX")
Set rsCredRepInfo = dbsTest.OpenRecordset
("tblCredRepInfo")

End Function

When I click my shortcut Access opens up and the macro
runs but I get a "User-defined type not defined error" in
my module's function code. So I guess this is really a
question about setting up connections to Access tables
within a function. Any experts out there to help?
 

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