473,396 Members | 1,743 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,396 software developers and data experts.

Repository for common forms across multiple .mdb's

topher23
234 Expert 100+
I have several forms and code subroutines that are common across the many databases that I support. The solution my predecessor, who built many of these databases, used was to put a copy of the forms and code into each database.

Over time, I've pulled most of the duplicated code out of the front-end applications and consolidated it into an .mdb used as a shared code repository. The code repository is then referenced in each application that it's needed in. This works great for code - not so great for forms.

Does anyone know of a way that I can do the same thing with the duplicate forms?
Nov 4 '09 #1

✓ answered by ADezii

I liked the concept proposed by topher23 so much, that I created code contained within a single Form that will:
  • Open an Office File Dialog filtered for Access Databases only (*.mdb).
  • Once a Database is selected, a List Box on the Form (MultiSelect = Extended, RowSourceType = 'Value List') is populated with the Names of all Forms residing in the External Database.
  • Simply select 1 or several Forms as so desired.
  • Click on a Command Button to Import the Selected Form(s) into the Current Database.
  • For any Project you create, include this Form Template to automate the Form Import process.
  • If anyone is actually interested, let me know and I'll post the code.

8 2817
ADezii
8,834 Expert 8TB
@topher23
If you use the same Code Routines across many Databases, then you should consider creating a Library Database(s) (*.mda). These Databases contain Code Modules shared by a number of Applications and they relieve you from having to create and maintain a separate Version of a Function in each Database where it is called. To reference these Library Databases:
  1. Tools
  2. References
  3. Browse
  4. Select "Add-ins (*.mda)"
  5. Locate your Library Database
  6. OK
Nov 4 '09 #2
topher23
234 Expert 100+
Right. If you read a bit closer you'll see that's exactly what I've already done. Originally, I named the file .mda, but I decided that the name was confusing as the database wasn't exactly an add-in, but a code repository, or library. When I hear library, I think books, so I don't use the term for db's. Sorry for the confusion there. Anyway, Access will reference the file as an add-in whether you name it .mda or .mdb, it doesn't really care.

The point is, is there any way to do it with forms? I looked into creating a true .mda add-in, complete with system tables and registry entries, but all indications are that simple forms still wouldn't work properly. Or am I reading too much into it, and creating an add-in is the way to go?
Nov 4 '09 #3
MMcCarthy
14,534 Expert Mod 8TB
I'm not sure if it could even be done with an add-in as I think forms need to be stored locally in a database. However, since I'm not sure I'll put out a call to some of our experts to see if anyone has any ideas.

Mary
Nov 5 '09 #4
missinglinq
3,532 Expert 2GB
I agree with Mary's assessment here! You're referencing code in libraries, but forms have to physically be present in a database. I think the closest you can come would be to have a database where you stored these forms and simply import a copy into you db that is currently under development.

Linq ;0)>
Nov 5 '09 #5
ajalwaysus
266 Expert 100+
@missinglinq
I also agree.
I have a tool I use right now that acts as a centralized DB for all my forms, references, and modules, which also houses all my DBs. So when I deploy any new DBs or make a changes to a "Shared" module, reference, or form, I can push out the changes through my central DB. But bottom line, I still have to store them in a DB.

-AJ
Nov 5 '09 #6
ADezii
8,834 Expert 8TB
I liked the concept proposed by topher23 so much, that I created code contained within a single Form that will:
  • Open an Office File Dialog filtered for Access Databases only (*.mdb).
  • Once a Database is selected, a List Box on the Form (MultiSelect = Extended, RowSourceType = 'Value List') is populated with the Names of all Forms residing in the External Database.
  • Simply select 1 or several Forms as so desired.
  • Click on a Command Button to Import the Selected Form(s) into the Current Database.
  • For any Project you create, include this Form Template to automate the Form Import process.
  • If anyone is actually interested, let me know and I'll post the code.
Nov 5 '09 #7
topher23
234 Expert 100+
Adezii, I like your thinking. You may even be able to set it up so you can push the forms from one database out to a completely different database using another list box. That would be some serious automation.

Well, as for my original question, I was able to slap together a sort of work-around. I used CreateObject to initiate my "library" in another instance of Access. For some reason, it hadn't occurred to me previously that CreateObject could be used to create more Access instances. Anyway, referencing that instance, I was able to pull up the form I wanted, manipulate the recordsource, and even populate data in the form from the original database based on data entered into and displayed on the form in the other instance. In my "calling" form, I used a loop to make sure the second form was closed before the calling subroutine killed the instance.

I won't post this code, since I figure it's pretty straightforward for anyone with a bit of experience and the ability to look up CreateObject in the help file (plus it's really ugly right now, as I've only just been testing it and I'm not certain it won't break).

Even more fun, I used a function that I found on the webs a while back to hide the second access window while still displaying the form (form has to be set to popup in order for this to work properly), making the transition between different instances of Access totally invisible to the user.

For anyone interested, this is the code that hides the Access window.
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Private Declare Function IsWindowVisible Lib "User32" (ByVal hWnd As Long) As Long
  4. Dim dwReturn As Long
  5.  
  6. Const SW_HIDE = 0
  7. Const SW_SHOWNORMAL = 1
  8. Const SW_SHOWMINIMIZED = 2
  9. Const SW_SHOWMAXIMIZED = 3
  10.  
  11. Private Declare Function ShowWindow Lib "User32" (ByVal hWnd As Long, _
  12.      ByVal nCmdShow As Long) As Long
  13.  
  14. Public Function pfnAccessWindow(Optional Procedure As String, Optional SwitchStatus As Boolean, Optional StatusCheck As Boolean) As Boolean
  15. If Procedure = "Hide" Then
  16.     dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
  17. End If
  18. If Procedure = "Show" Then
  19.     dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
  20. End If
  21. If Procedure = "Minimize" Then
  22.     dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMINIMIZED)
  23. End If
  24. If SwitchStatus = True Then
  25.     If IsWindowVisible(hWndAccessApp) = 1 Then
  26.         dwReturn = ShowWindow(Application.hWndAccessApp, SW_HIDE)
  27.     Else
  28.         dwReturn = ShowWindow(Application.hWndAccessApp, SW_SHOWMAXIMIZED)
  29.     End If
  30. End If
  31. If StatusCheck = True Then
  32.     If IsWindowVisible(hWndAccessApp) = 0 Then
  33.         pfnAccessWindow = False
  34.     ElseIf IsWindowVisible(hWndAccessApp) = 1 Then
  35.         pfnAccessWindow = True
  36.     End If
  37. End If
  38. End Function
Nov 6 '09 #8
NeoPa
32,556 Expert Mod 16PB
Nice work Topher.

I've never really played much with different types of Access files, but I hed a question the other day about MDEs and thought I'd experiment a little.

When I read this I decided I'd do the same with MDAs (this afternoon). Fun isn't it. I just wish I'd bothered earlier. It's only recently that I've done much work creating new databases and requiring much of the functionality to be available that I had previously developed, but this is certainly worth knowing about. I'm sure I'll play more soon.
Nov 8 '09 #9

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

Similar topics

3
by: Ron Nolan | last post by:
I have a large application that contains lots and lots of financial history data. The history data is currently set up in a table called 'TblHist' that exists inside each of these three .mdb...
3
by: Frank | last post by:
We have an Access database Sch_S.mdb in the shared driver S across the network. I have a copy of that database in my local driver C, named as Sch_C.mdb. As per users' request I added some check...
2
by: Thom Little | last post by:
I have two forms (Help and About). How can I prevent one of the forms from being displayed when the other form is currently displayed? They are rendered from menu selections using ... ...
2
by: Mervin Williams | last post by:
I am using Infragistics UltraWebTab (a tab folder control for ASP.NET). My tab folder control will include five tab pages with a separate web form on each, and these web forms will share data. ...
1
by: ngodugu | last post by:
Hi All, Is there any way to use a common login page across multiple web applications? I have tried couple of things that were suggested on MSDN but they did not work. ...
2
by: code | last post by:
Hi, I have stumbled across an interesting problem regarding forms authentication over multiple sub domains. The topic has been covered in various forms online but never really gets a definitive...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
4
by: =?Utf-8?B?RmFyaWJh?= | last post by:
It know that we can use the following method http://msdn2.microsoft.com/en-us/library/eb0zx8fc.aspx to form authenticate across multiple applications. I have created an asp.net application...
6
by: John | last post by:
I have a multi-user Access database with back- and front end on the network. Problem is that the forms don't get refreshed automatically: if user A enters a record it will only become available to...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.