Reference variable from one Db While in Another

C

Curious George

I have the following code that opens a second instance of
Access. What I would like is to pass a parameter to the
the second instance, from the a variable in the first
instance. Is this possible and what might the code/process
look like. Also I would like to avoid filling a table and
referencing that.

Public Sub Open_MainProgram(Mem_App_Name As String)

Dim str As String
Dim str2 As String
str2 = "[app_name] = " & Chr(34) & Mem_App_Name & Chr
(34)
str = DLookup("[destination]", "Tbl_version_master",
str2)

Set oAccess = CreateObject("Access.Application")
oAccess.Visible = True
oAccess.OpenCurrentDatabase str
End Sub
 
N

Naresh Nichani MVP

Hi:

You could open a form in second Access instance and pass a OpenArg like this

'Open Form Test with OpenArg = "HaHa"
objAccess.Docmd.OpenForm "test",acNormal,,,,,"HaHa"

In Form "Test" you can get the OpenArg with Me.OpenArgs

Regards,

Naresh Nichani
Microsoft Access MVP
 

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