Peg said:
Your suggestion is closer to what I want to do. It's ok if Access is
running
in the background, but I'd like to open and use the Access Form that I
made
directly from the desktop.
I just have no clue how to make that happen. I don't know what to call
what
I'm trying to do so I can't even really consult the Help file.
The help file wouldn't help you here, because this isn't the way Access is
designed to work. However, you can approach it two different ways:
1. You can size the form to the Access application window, or resize the
application window to just fit the form. The former can be done using the
code here:
http://www.mvps.org/access/api/api0022.htm
The latter can be done using Nicole Calinoiu's FormWindow class, posted
here:
http://www.mvps.org/access/forms/frm0042.htm
With that class module in your database, your form could have code like this
in its Open event:
Dim fwForm As New clFormWindow
Dim fwApp As New clFormWindow
Dim fwInside As clFormWindow
Dim lngVerticalOffset As Long
Dim lngHorizontalOffset As Long
fwForm.hwnd = Me.hwnd
Set fwInside = fwForm.Parent
fwApp.hwnd = hWndAccessApp
lngVerticalOffset = (fwApp.Height - fwInside.Height) + 10
lngHorizontalOffset = (fwApp.Width - fwInside.Width) + 10
With fwApp
.top = fwForm.top + lngVerticalOffset
.Left = fwForm.Left + lngHorizontalOffset
.Height = fwForm.Height + (lngVerticalOffset - 6)
.Width = fwForm.Width + (lngHorizontalOffset - 6)
End With
fwForm.top = 0
fwForm.Left = fwInside.Left
2. You can hide the application window completely by calling a Windows API
function, as described here:
http://www.mvps.org/access/api/api0019.htm
It mentions in that article that your form's PopUp property must be set to
Yes. On top of that, in recent versions of Windows your form's Modal
property must also be set to Yes. With that code saved in a module in your
database, you would set your form as the application's startup form, and
then have code like this in the form's Open event:
Private Sub Form_Open(Cancel As Integer)
Me.Visible = True
DoEvents
fSetAccessWindow SW_HIDE
End Sub