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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CLOSE BUTTON 1

Status
Not open for further replies.

ZaZa

Technical User
Sep 5, 2001
85
US
Can any one tell me how to Diasble/Enable the Close button and the MinMax buttons programmaticaly ?

I have a form that can be opened via different paths in the database. Sometimes it is opened in datasheet view and sometimes it is opened in Form View.

When it is in datasheet view, I want to have the Close Button and the MinMax button.
But I don't want them in form view.

I have tried installing the following line of code on the On open event and even on teh On load evet but I keep getting a message that "YOU CAN'T ASSIGN A VALUE TO THIS OBJECT".

Is there any why to get this thing working? What am I doing wrong?
--------------------------
If Me.CurrentView = 2 Then
Me.CloseButton = True
Me.MinMaxButtons = 3
Else
Me.CloseButton = False
Me.MinMaxButtons = 0
End If
_-----------

thanks in advance,
ZaZa
 
One way:
Set the form's ControlBox property to No - this will get rid of the min, max, and close buttons all together.
To prevent form resizing, set the form's Border Style property to anything but Sizeable
 
check out my post that's about 10 threads ahead of yours. The same could apply for you.

Don't worry about the control itself, worry about the action it's preforming. I.E. Close or UnLoad.
 
Thanks a lot Dschomburg!!

That little piece of code was a gem!

To cater for the case where the form is in data sheet view and I need to use the close button, I put the following three lines before your code on the unload event:
------------
If Me.Currentview = 2 then
isclosing = true
End If
-----------

That way the close button is only disabled if the form is in form view. Thanks a lot for your time and for responding.

ZaZa

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top