jwcolby
jwcolby at colbyconsulting.com
Tue Aug 31 22:33:11 CDT 2010
OK, I get the picture. The problem though is that I am actually using select queries, not tables. Filtered queries etc. If I store the query itself in the library then I have to get at it. I don't want to store the query itself in the FE. Anyway, I do have a solution, a better solution than I came up with the last go round. My tables do have to be in the FE but beyond that it is working. The biggest issue is that I have to set the RowSource / recordsource of objects in code in the OnOpen. All of this is for my Presentation Level Security and I just want to leave as much as I can in the lib. John W. Colby www.ColbyConsulting.com Michael Mattys wrote: > I remember going through those viewable wizards and doing what you ask. Your > addin would do the same as this (not solving the problem): > > Dim appAccess As Access.Application > ' Create new instance of Microsoft Access. > Set appAccess = CreateObject("Access.Application") > ' Open database in Microsoft Access window. > appAccess.OpenCurrentDatabase strFileName > ' Open Orders form. > appAccess.DoCmd.OpenForm "frmOpen", acNormal, , , , AcDialog > 'appAccess.CloseCurrentDatabase > Set appAccess = Nothing > > I wonder, then, if you can set the form recordsource to > dbEngine(0)(?)!tdfname. I'll try it in a few minutes. > > Michael R Mattys > Business Process Developers > www.mattysconsulting.com > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Tuesday, August 31, 2010 10:40 PM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Leave a bound form in a library. > > > It can be done using OpenCurrentDatabase and also, > > possibly, dbEngine(0)(1). > > Hmm... what does that do for me? > > I am using a method to take three parts of the sql statement and build them > up dynamically. > > ' > 'Open the currentdb and hold a pointer to it for speed. > ' > Function dbDAOCurr() As DAO.Database > Static db As DAO.Database > If db Is Nothing Then > Set db = CurrentDb > End If > Set dbDAOCurr = db > End Function > > ' > 'Take the SELECT, Where and Orderby parts of a SQL statement and build them > into > 'a sql string, inserting the name of the current database. > ' > Function mPLSSQL(strObjSelect As String, Optional strWhere As Variant, > Optional strOrderBy As > Variant) As String > Dim strSQL As String > strSQL = strObjSelect > strSQL = strSQL & " in '" & dbDAOCurr.name & "' " > If Not IsMissing(strWhere) Then > strSQL = strSQL & strWhere & " " > End If > If Not IsMissing(strOrderBy) Then > strSQL = strSQL & strOrderBy > End If > mPLSSQL = strSQL > End Function > > > John W. Colby > www.ColbyConsulting.com > > > Michael Mattys wrote: >> Hi John, >> >> That's how I usually do it, but I am aware that >> It can be done using OpenCurrentDatabase and also, >> possibly, dbEngine(0)(1). >> >> Michael R Mattys >> Business Process Developers >> www.mattysconsulting.com >> >> -----Original Message----- >> From: accessd-bounces at databaseadvisors.com >> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby >> Sent: Tuesday, August 31, 2010 9:38 PM >> To: Access Developers discussion and problem solving >> Subject: [AccessD] Leave a bound form in a library. >> >> One of the challenges of using an "addin" library is placing forms in the >> add-in but having them >> load records from the FE. For example if I make a bound form to load the >> users table but I leave >> that form in the library (add-in), then when the form opens it tries to > load >> the data from the table >> in the library. IOW a form tries to pull its data from whatever container >> it is placed in. >> >> One way around that is to use the "in 'MyFePath\MyDbName.mdb' syntax that > is >> valid in access. As an >> example SQL to pull the records from the FE might look as follows: >> >> SELECT * FROM usystblPLSObjFrm in 'C:\Dev\C2DbPLS\C2DbPLS.mda' ORDER BY >> PLSF_Name; >> >> This would obviously pull all fields from the table usystblPLSObjFrm >> physically located in >> C:\Dev\C2DbPLS\C2DbPLS.mda. >> >> This is a PITA and requires jumping through hoops but that is the only >> solution that I know of. >> >> If any of you know of another solution please let me know since I do have > to >> get adept at hoop >> jumping to do it my way. >> >> Thanks,