Is there a simple way to import all forms from another mdb into the currently open mdb? I have trouble getting the current code to "see" a "forms" object in the external mdb.
MS Access Import Forms from another mdb
Collapse
X
-
Tags: None
-
Originally posted by pks00did u try File/Get External Data/Import ?
In trying this, I have problems setting up the foreign "Forms" object to cycle through. Any Ideas?Comment
-
Originally posted by NeoPaForms is an attribute of the Application object and is NOT what contains the objects to be imported.
The Forms collection contains only open forms in the currently open database.Comment
-
Hi
I am trying to do exactly the same thing. Have you found a way yet?
Originally posted by Mac CampbellI would like to do this in VBA because there seems to be a hole in my understanding of the "Forms" identity. If I View the objects, I can see what appears to be a "Forms" object but I could not create or "cast" the Application.Cur rentProject.All forms (object/container) into a Forms object. I seem to have a blind spot here. Is there a good source where I might get an understanding of this.Comment
-
Originally posted by Mac CampbellI would like to do this in VBA because there seems to be a hole in my understanding of the "Forms" identity. If I View the objects, I can see what appears to be a "Forms" object but I could not create or "cast" the Application.Cur rentProject.All forms (object/container) into a Forms object. I seem to have a blind spot here. Is there a good source where I might get an understanding of this.
Application.Cur rentProject.All Forms is a Collection object. The object 'contains' form objects but is not, itself, a Form object. Does that throw any light on the problem?Comment
-
Originally posted by joeldbHi
I am trying to do exactly the same thing. Have you found a way yet?
You can see the same as we can what's in here.
Your choices are to :- Follow this thread (you're already subscribed now).
You can contribute too if that will help. - Create a new thread of your own with a well phrased question.
Please don't though, divert the course of this thread for your own purposes (Don't worry - you haven't done so far) as that can cause confusion and irritation for all concerned.
MODERATOR.Comment
- Follow this thread (you're already subscribed now).
-
Hi
I've managed to do it like this:
Code:Dim appAccess As Access.Application Dim fileNameStr As String Dim frmSearch As Variant ' this is the file you are importing from fileNameStr = "C:\My Documents\Update1.mdb" Set appAccess = New Access.Application appAccess.OpenCurrentDatabase fileNameStr For Each frmSearch In appAccess.CurrentProject.AllForms 'transfer each form - use the same name DoCmd.TransferDatabase acImport, "Microsoft Access", fileNameStr, acForm, frmSearch.Name, frmSearch.Name ' for testing Debug.Print frmSearch.Name Next frmSearch appAccess.CloseCurrentDatabase Set appAccess = Nothing
Hope this helps
Joel
Originally posted by joeldbHi
I am trying to do exactly the same thing. Have you found a way yet?Comment
-
Originally posted by joeldbHi
I've managed to do it like this:
Code:Dim appAccess As Access.Application Dim fileNameStr As String Dim frmSearch As Variant ' this is the file you are importing from fileNameStr = "C:\My Documents\Update1.mdb" Set appAccess = New Access.Application appAccess.OpenCurrentDatabase fileNameStr For Each frmSearch In appAccess.CurrentProject.AllForms 'transfer each form - use the same name DoCmd.TransferDatabase acImport, "Microsoft Access", fileNameStr, acForm, frmSearch.Name, frmSearch.Name ' for testing Debug.Print frmSearch.Name Next frmSearch appAccess.CloseCurrentDatabase Set appAccess = Nothing
Hope this helps
Joel
It uses Application Automation too.
We always appreciate when members post answers after finding them, so well done on that score too.
BTW Within Access, the object Application would be equivalent (and predefined) for what you set up in appAccess.Comment
Comment