Using some automation (Read the Access VBA Help articles on
"GetObject Method" and "CreateObject Method" for more information) you can
achieve this. Try something like
Function OpenExDdForm(sDb As String, sForm As String)
On Error GoTo Error_Handler
Dim appAccess As Access.Application
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase sDb
appAccess.Visible = True
' Open the form.
appAccess.DoCmd.OpenForm sForm
'...do what ever you want
'When we are done clean up our variables.
Set appAccess = Nothing
If Err.Number = 0 Then Exit Function
Error_Handler:
MsgBox "MS Access has generated the following error" & vbCrLf & vbCrLf &
"Error Number: " & _
Err.Number & vbCrLf & "Error Source: OpenExDdForm" & vbCrLf & "Error
Description: " & _
Err.Description, vbCritical, "An Error has Occured!"
Exit Function
End Function
Then you'd call it:
OpenExDdForm("S:\HQ Common\DC_Finance\DATA_ANALYSIS\PAYBACKS\CM-DM
Downloads.mdb", "frmCMLabelsDataEntry")
--
Hope this helps,
Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples:
http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.