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

Disable command button if form opened in edit mode?

Status
Not open for further replies.

gusbrunston

Programmer
Feb 27, 2001
1,234
US

Hi.

On a check entry form there is a command button that shows/hides the activex calendar control. I want to hide or disable the button when the form is opened in edit mode. How am I going to do that without help from you? Thanks in advance.

I've had another day above ground! Gus Brunston :cool: An old PICKer, using Access2000. Celebrating this year my 72nd birthday and my 50th wedding anniversary.
padregus@attbi.com

 
Hi Gus

Contulations on your 72 and 50 years, the way you are going I am sure you have many more to come ;-).

To the point, I am not sure if I understand you correctly but you could use:

If your_condition then MyButton.enabled=false else MyButton.enabled=true

Hope this will help you.

Michael
 

Michael, thank you very much.

Here's what I worked out:
Code:
Private Sub Form_Open(Cancel As Integer)
    If Me.DataEntry = True Then
        Me.Label124.Visible = True
        Me.Command123.Enabled = True
    Else
        Me.Label124.Visible = False
        Me.Command123.Enabled = False
    End If
End Sub

(The button is transparent, on top of "Label124".)

This hides the label AND disables the button when in edit mode. The problem I was having was when the user opened the calendar when an old record was current, the date on the old record was being changed when the user set a new date. Gus Brunston :cool: An old PICKer, using Access2000. Celebrating this year my 72nd birthday and my 50th wedding anniversary.
padregus@attbi.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top