Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Close 2

Status
Not open for further replies.

georgesOne

Technical User
Jul 2, 2004
176
JP
Hi everybody,

is there a way to set the controlbox and form closebutton in VBA according to the user, something like

If User1 Then
Me.Controlbox = True
Me.Closebutton = True
Else
Me.Controlbox = False
Me.Closebutton = False
End If

This obviously does not work... the manual says the form must be in design view.

Some suggestions?

Thanks, georgesOne
 
Set the
Build your own close buttons on the form, and then show or hide them. You can open a form in design view, but I do not recommend it. If you really had to, this is how you could do it.

Code:
Public Sub frmCloseBtn(frmName As String, blnCloseBtn As Boolean, intMinMax As Integer)
  Dim frm As Access.Form
  DoCmd.OpenForm frmName, acDesign, , , , acHidden
  Forms(frmName).CloseButton = blnCloseBtn
  Forms(frmName).MinMaxButtons = intMinMax
  DoCmd.Save acForm, frmName
  DoCmd.OpenForm frmName
End Sub

Public Sub testform()
  'minmax buttons are 0,1,2,3
  'None, min, max, both
  frmCloseBtn "Categories", True, 0
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top