473,378 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

MS Access Import Forms from another mdb

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.
Apr 25 '07 #1
10 18539
pks00
280 Expert 100+
did u try File/Get External Data/Import ?
Apr 26 '07 #2
NeoPa
32,556 Expert Mod 16PB
For all forms (especially when there are many) the Import method is best. For an individual form, it is possible to use simply Copy/Paste as long as both databases are open.
Apr 26 '07 #3
did u try File/Get External Data/Import ?
That works great but I would like to be able to do this using VBA code.
In trying this, I have problems setting up the foreign "Forms" object to cycle through. Any Ideas?
Apr 30 '07 #4
NeoPa
32,556 Expert Mod 16PB
Forms 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.
Apr 30 '07 #5
Forms 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.
I 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.CurrentProject.Allforms (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.
May 1 '07 #6
joeldb
2
Hi

I am trying to do exactly the same thing. Have you found a way yet?


I 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.CurrentProject.Allforms (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.
May 10 '07 #7
NeoPa
32,556 Expert Mod 16PB
I 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.CurrentProject.Allforms (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.
There probably is, but I'm not that good on external references.
Application.CurrentProject.AllForms is a Collection object. The object 'contains' form objects but is not, itself, a Form object. Does that throw any light on the problem?
May 10 '07 #8
NeoPa
32,556 Expert Mod 16PB
Hi

I am trying to do exactly the same thing. Have you found a way yet?
Joel,
You can see the same as we can what's in here.
Your choices are to :
  1. Follow this thread (you're already subscribed now).
    You can contribute too if that will help.
  2. 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.
May 10 '07 #9
joeldb
2
Hi

I've managed to do it like this:

Expand|Select|Wrap|Line Numbers
  1. Dim appAccess As Access.Application
  2. Dim fileNameStr As String
  3. Dim frmSearch As Variant
  4.  
  5. ' this is the file you are importing from
  6. fileNameStr = "C:\My Documents\Update1.mdb"
  7.  
  8. Set appAccess = New Access.Application
  9. appAccess.OpenCurrentDatabase fileNameStr
  10.  
  11. For Each frmSearch In appAccess.CurrentProject.AllForms
  12.  
  13. 'transfer each form - use the same name
  14. DoCmd.TransferDatabase acImport, "Microsoft Access", fileNameStr, acForm, frmSearch.Name, frmSearch.Name
  15.  
  16. ' for testing
  17. Debug.Print frmSearch.Name
  18.  
  19. Next frmSearch
  20.  
  21. appAccess.CloseCurrentDatabase
  22. Set appAccess = Nothing


Hope this helps

Joel


Hi

I am trying to do exactly the same thing. Have you found a way yet?
May 10 '07 #10
NeoPa
32,556 Expert Mod 16PB
Hi

I've managed to do it like this:

Expand|Select|Wrap|Line Numbers
  1. Dim appAccess As Access.Application
  2. Dim fileNameStr As String
  3. Dim frmSearch As Variant
  4.  
  5. ' this is the file you are importing from
  6. fileNameStr = "C:\My Documents\Update1.mdb"
  7.  
  8. Set appAccess = New Access.Application
  9. appAccess.OpenCurrentDatabase fileNameStr
  10.  
  11. For Each frmSearch In appAccess.CurrentProject.AllForms
  12.  
  13. 'transfer each form - use the same name
  14. DoCmd.TransferDatabase acImport, "Microsoft Access", fileNameStr, acForm, frmSearch.Name, frmSearch.Name
  15.  
  16. ' for testing
  17. Debug.Print frmSearch.Name
  18.  
  19. Next frmSearch
  20.  
  21. appAccess.CloseCurrentDatabase
  22. Set appAccess = Nothing


Hope this helps

Joel
Nice solution 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.
May 10 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ashish_khanna | last post by:
I have an MDI form. from here i am opening my child forms by creating objects. Plz tell me how to make single instance of these forms. and how to access ActiveMDI forms public methods
2
by: TomB | last post by:
Ok, I'm new to dotnet. Not only do I need help I need to know which of the dotnet groups would be best for this question. I have over 30 applications in Access with nearly 300 forms that have to...
3
by: Danny | last post by:
Hello How can I make access import a tab delimited text file that contains a special char u (but with the dots over it like a german spelling). The u shows with the two dots in the text file but...
3
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook -...
2
by: gthompson | last post by:
I'm redesigning my Access Form in Visual Studio (asp.net) so that I can have a Web application connected to the Access Database. It is a user form. Is there any way to have a subform in Visual...
4
by: Thelonious Monk | last post by:
Is it possible to convert Microsoft Access 2000 forms and import them into a Visual Basic .NET project? This may be a far-fetched question, but it sure would be nice to do. Thanks!
3
by: teranews | last post by:
My question is this... Is 'LINK'ing a stylesheet required before 'IMPORT'ing another for successful hovering? I have a problem which cropped up with the introduction of IE 7 Beta 2... Yes.....
10
by: =?Utf-8?B?MjJQb20=?= | last post by:
Hi All, Thanks to Family Tree Mike I've managed to get a Solution up and running, now comes the fun part. How do I call forms from other Class Libraries and how do I use a Background form...
4
by: labmonkey111 | last post by:
The company I work for uses a very large program in Access/VBA. Whenever I edit it, I copy the latest edition to my harddrive and make the necessary changes, then copy the modified...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.