J
juneBug via AccessMonster.com
Hello.
I am losing my mind and need a bit of help...the task is simple...open a MS
Access (97) form in another database and pass its recordsource as a string
back to the current db.
Here is what I got...I managed to get it working then I messed it up somehow..
...grrr. The function below takes 2 parameters...objName (name of the object I
want to open) and objType (type of the object- form, table etc). I cut out
the other case statements dealing with tables/queries etc. I am only
interested in forms right now.
'''''''''''''''''''''''''''''''''''''''''''''''''
'start of code
'''''''''''''''''''''''''''''''''''''''''''''''''
Public Function getRecordSource(inObjType As String, inObjName As String) As
String
Dim myForm As Form, myApp As Access.Application
Select Case inObjType
Case "Form"
Set myApp = New Access.Application
myApp.OpenCurrentDatabase [enter db name/location]
MsgBox myApp.Forms(inObjName).RecordSource
myApp.CloseCurrentDatabase
end select
Set myApp = Nothing
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''
'end of code
'''''''''''''''''''''''''''''''''''''''''''''''''
Right now the other database opens but I keep getting an error message that
the object I am looking for is not found even though I know it is there.
Any help would be appreciated. Also wondering if there is any way to open the
database and retrieve a report/form without actually opening the db, much
like the case of retireving tabledefs from another db using DAO.
THANKS.
juneBug
I am losing my mind and need a bit of help...the task is simple...open a MS
Access (97) form in another database and pass its recordsource as a string
back to the current db.
Here is what I got...I managed to get it working then I messed it up somehow..
...grrr. The function below takes 2 parameters...objName (name of the object I
want to open) and objType (type of the object- form, table etc). I cut out
the other case statements dealing with tables/queries etc. I am only
interested in forms right now.
'''''''''''''''''''''''''''''''''''''''''''''''''
'start of code
'''''''''''''''''''''''''''''''''''''''''''''''''
Public Function getRecordSource(inObjType As String, inObjName As String) As
String
Dim myForm As Form, myApp As Access.Application
Select Case inObjType
Case "Form"
Set myApp = New Access.Application
myApp.OpenCurrentDatabase [enter db name/location]
MsgBox myApp.Forms(inObjName).RecordSource
myApp.CloseCurrentDatabase
end select
Set myApp = Nothing
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''
'end of code
'''''''''''''''''''''''''''''''''''''''''''''''''
Right now the other database opens but I keep getting an error message that
the object I am looking for is not found even though I know it is there.
Any help would be appreciated. Also wondering if there is any way to open the
database and retrieve a report/form without actually opening the db, much
like the case of retireving tabledefs from another db using DAO.
THANKS.
juneBug