Results 1 to 7 of 7
  1. #1
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    If number then set close button on form to false

    I'm trying to figure out what I am doing wrong

    I have in vba

    if StatusID = 5 then
    me.CloseButton = false
    end if



    The statusID is on the subform

    I tried me.parent.closebutton

    I also tried me.form.closebutton

    I get errors...

    what have I missed?

  2. #2
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    I have tried this too

    Forms!frmBookingEdit.CloseButton = False

    I always get this error - Runtime Error '2136'

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    It seems it is not possible to set the property anywhere other than the form's design view. I tried too, didn't work in VBA on the form's load event. 2003 or 2010

    Never tried that one before, now I know. The help files state that it can only be done in design view, just below where it describes it can be done using the form's properties, macros, or VBA

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    me.CloseButton = false
    A button does not have value property so you cannot set a button to "FALSE".

    What exactly are you trying to do?

    Are you trying to disable the button? Then you would use "me.CloseButton.Enabled = false"
    Are you trying to hide the button? Then you would use "me.CloseButton.Visible = false"

  5. #5
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by ItsMe View Post
    It seems it is not possible to set the property anywhere other than the form's design view. I tried too, didn't work in VBA on the form's load event. 2003 or 2010

    Never tried that one before, now I know. The help files state that it can only be done in design view, just below where it describes it can be done using the form's properties, macros, or VBA
    I read that too, I'm kind of surprised. I will have to set the form close button to no, create a button that closes the form and hide that on the if

    Thank you kindly for your response itsme

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    That is the way I have always done it. Having your own close button is nice because then you can execute code to verify everything is good to go before the user bails out.

  7. #7
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by ItsMe View Post
    That is the way I have always done it. Having your own close button is nice because then you can execute code to verify everything is good to go before the user bails out.
    Yeah, that actually made things better by using that method in the long run anyway

    thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Close Form button not working
    By RedGoneWILD in forum Forms
    Replies: 2
    Last Post: 06-25-2012, 07:02 AM
  2. Replies: 2
    Last Post: 05-11-2012, 11:52 AM
  3. Replies: 11
    Last Post: 01-26-2012, 01:22 PM
  4. Disable master form close button
    By Carpy01 in forum Forms
    Replies: 3
    Last Post: 12-31-2010, 05:41 PM
  5. Replies: 4
    Last Post: 09-10-2009, 03:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums