Easiest approach would be to pass something as the OpenArgs parameter and use that to determine whether or not to show the command button.
Something like:
DoCmd.OpenForm "NameOfForm", acNormal, OpenArgs:="Case1"
and
DoCmd.OpenForm "NameOfForm", acNormal, OpenArgs:="Case2"
then in the Load event of the form:
Private Sub Form_Load()
If IsNull(Me.OpenArgs) = False Then Select Case Me.OpenArgs Case "Case1" Me!MyCommandButton.Visible = False Case "Case2" Me!MyCommandButton.Visible = True End Select End If
End Sub
-- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please)
"TeeSee" <bkeanie[ at ]glasscellisofab.com> wrote in message news:3eef038b-66b1-492c-8f85-36a9126fd4b0[ at ]33g2000yqm.googlegroups.com...
[Quoted Text] >I would like to use an existing form "frmMaterialMasterADD" for two > different applications within the same DB. The path to the form comes > from two different CmdButtons. The bound information and format would > not change but I would like to place/show/activate a CmdButton on one > showing of the form and not show it on the other. Where and how would > I code this? > > Thanks as always.
|