Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

Open Form In An External Database

19 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Al Aston

ungelesen,
29.07.2002, 20:54:3029.07.02
an
I'm trying to open a form in another database. Thanks to Bob Hall, I can
open a form by calling the form's Open event in a module in the library
database. This works, but the second database stays open until the main
database closes. Is there a way to close the second DB when the called form
closes? (When I'm done, a large system will be broken into 5 or 6, and each
of those will grow quickly, which will be a lot of overhead if they are all
open at once.)

I've also been looking at Dev Ashish's terrific site, and came across this:
http://www.mvps.org/access/forms/frm0034.htm
Everything works step-by-step from the calling form and into the module, but
fails on the line:
".DoCmd.OpenForm strForm, intView", where the error message is "Error#:
2046 The command or action 'OpenForm" isn't available now."

Any ideas from the gurus?

Al Aston

Lyle Fairfield

ungelesen,
29.07.2002, 22:07:2229.07.02
an
AC97 forms are fully exposable, and probably this could be modified for 2K and
XP:

Option Compare Database
Option Explicit
Const strExposed As String = "Attribute VB_Exposed = True" & vbCrLf
Const strStartModule = "CodeBehindForm"

Sub ExposeForm(strFormName)
Dim strFromPath As String, StrToPath As String, intFileNumber As Integer,
_
lngLen As Long, lngLeft As Long, _
strBuffer As String, strLeft As String, strRight As String

strFromPath = Environ("Temp") & "\" & strFormName & "_Original.Txt"
StrToPath = Environ("Temp") & "\" & strFormName & "_Revised.Txt"

Application.SaveAsText acForm, strFormName, strFromPath

lngLen = FileLen(strFromPath)
intFileNumber = FreeFile
Open strFromPath For Input As #intFileNumber
strBuffer = Input(lngLen, #intFileNumber)
lngLeft = InStr(strBuffer, strStartModule) + Len(strStartModule)
strLeft = left(strBuffer, lngLeft) & vbCrLf
strRight = Mid(strBuffer, lngLeft + 2)
strBuffer = strLeft & strExposed & strRight
Close #intFileNumber

intFileNumber = FreeFile
Open StrToPath For Output As #intFileNumber
Print #intFileNumber, strBuffer
Close #intFileNumber

Application.LoadFromText acForm, strFormName, StrToPath

End Sub

"Al Aston" <aas...@mindspring.com> wrote in news:ai4o5j$ptb$1
@nntp9.atl.mindspring.net:

--
Lyle

0 neue Nachrichten