[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

referring to a form instance in front-end database

Posted on 2010-01-01
4
Medium Priority
?
435 Views
Last Modified: 2013-11-28
I am using a collection to manage form instances in my front-end database, such as this:

Function fOpenFormInstance(strForm As String)
    On Error GoTo Err_event
    Dim frm As Form
    Select Case strForm
        Case "frmEntityMgmt"
            Set frm = New Form_frmEntityMgmt
            clnForms.Add Item:=frm, Key:=CStr(frm.Hwnd)
            frm.Tag = frm.Hwnd
      End Select
    frm.Visible = True
Exit_Event:
    Set frm = Nothing
    Exit Function
Err_event:
    MsgBox Err.Description
    GoTo Exit_Event
End Function

I then have several different functions that I use, and refer to the active form in this manner:

Public Function fLoadEntityMgmtSubforms(strFormID As String)
    Set frmCurrent = clnForms(strFormID)
    If frmCurrent.Controls("ctlName").value = ""....

If I want to create a library db to store a lot of my functions in, how would I refer to the instance of the form in my front-end database?  (in the above example obviously the forms collection and function are in the same database)
0
Comment
Question by:MsSherry
  • 2
  • 2
4 Comments
 
LVL 85
ID: 26159120
I'm not sure you can, although you may be able to contrive some form of interaction between the two.

You would be far better served placing code like this in a standard module, and just importing that module to all new databases you build.
0
 

Author Comment

by:MsSherry
ID: 26162274
Thanks LSM and sorry about the late response... Cable went out as well as my internet service!  Thanks for your suggestion.  I'll keep question opened for another day, and then reward you the points if I get no solution, but I think you may be right.
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 26165298
Working with Object instances via referenced modules (i.e. your standard library database) is not the best way, in my opinion. In my opinion, those library database should be used for code routines that don't really have to interact directly with running objects. You could perhaps alter your routines such that you would pass INTO that routine a form or report object, then your code could act upon that object. That said, I'm not sure a referenced database could do that.

It seems that most Access developers use the "import the module" routine for these sorts of things, but there are several out there using the referenced databases for code repositories.

Good luck in whatever method you choose!
0
 

Author Closing Comment

by:MsSherry
ID: 31671823
Thanks LSM.  Sometimes I tend to over-complicate things in an attempt to simplify things ... :)  I have used your suggestion and narrowed down the modules I am storing in the library database.

Thanks again
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question