I have used the following code which works great, the only thing is that I
want my subform to open as a dialog form.
Private Sub Inactivate_Click()
' This code created in part by Command Button Wizard.
On Error GoTo Err_Inactivate_Click
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
Dim strDocName As String, strLinkCriteria As String
' If CompanyName control is blank, display a message.
If IsNull(Me![Company_Name]) Then
strMsg = "Move to the vendor record you want to see, then press the
Inactivate button again."
intStyle = vbOKOnly
strTitle = "Select a Vendor"
MsgBox strMsg, intStyle, strTitle
Me![Company_Name].SetFocus
Else
' Otherwise, open Inactivate Vendor form for current vendor.
strDocName = "POP:Company_Inactivation"
strLinkCriteria = "Company_ID = " +
CStr(Forms![F:Vendor_Entry]![Company_ID])
DoCmd.OpenForm strDocName
Forms![POP:Company_Inactivation].Filter = strLinkCriteria
Forms![POP:Company_Inactivation].FilterOn = True
End If
Exit_Inactivate_Click:
Exit Sub
Err_Inactivate_Click:
MsgBox Err.Description
Resume Exit_Inactivate_Click
End Sub
If I use DoCmd.OpenForm strDocName, acNormal, ,
Forms![POP:Company_Inactivation].Filter = strLinkCriteria, acFormEdit,
acDialog
the form comes up in dialog mode but the filter is not applied. I am
stumped! Any suggestions would be appreciated.
Thanks!
Jonathan Parminter - 27 Jan 2005 00:01 GMT
Hi Wendyhnc, use the windowmode argument (combine with form properties of
centre =yes and resize=yes). The example below uses named arguments...
DoCmd.OpenForm FormName:=strDocName, WindowMode:=acDialog
Luck
Jonathan
> I have used the following code which works great, the only thing is that I
> want my subform to open as a dialog form.
[quoted text clipped - 44 lines]
>
> Thanks!
wendyhnc - 27 Jan 2005 16:15 GMT
That's the same issue I was having with the regular openform command, the
form opens in dialog mode but the filter is not applied.
> I have used the following code which works great, the only thing is that I
> want my subform to open as a dialog form.
[quoted text clipped - 44 lines]
>
> Thanks!
Jonathan Parminter - 27 Jan 2005 19:19 GMT
> That's the same issue I was having with the regular openform command, the
> form opens in dialog mode but the filter is not applied.
[quoted text clipped - 47 lines]
> >
> > Thanks!
Hi Wendy,
try...
DoCmd.OpenForm FormName:=strDocName, _
WhereCondition:=strLinkCriteria, _
WindowMode:=acDialog
that is, open the form with the filter applied. Any code following this will
not run until the form is closed (because of the window mode).
Luck
Jonathan
wendyhnc - 27 Jan 2005 19:33 GMT
Awesome! Thank you so much, it worked like a charm. Have a wonderful day!
> I have used the following code which works great, the only thing is that I
> want my subform to open as a dialog form.
[quoted text clipped - 44 lines]
>
> Thanks!