Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Enable controls


Message #1 by "Nikola" <Nikola@b...> on Wed, 30 Oct 2002 08:17:40 -0000
Hi all,
How to enable/disable controls in detail of form try edit button was trying
with Me.AllowEdits and Me.AllowAdditions but on this way is disabled tree
combobox in Header of form.

Message #2 by "Amy Wyatt" <amyw@c...> on Wed, 30 Oct 2002 17:15:13
To disable the controls in only the detail section you would need to set 
Enabled property of each control.

Hope this helps,

Amy



> Hi all,
How to enable/disable controls in detail of form try edit button was trying
with Me.AllowEdits and Me.AllowAdditions but on this way is disabled tree
combobox in Header of form.

Message #3 by "Nikola" <Nikola@b...> on Wed, 30 Oct 2002 19:56:10 -0000
To enable/disable controls in detail section this code working for me :

--------------------- start ------------------------

Private Sub Form_Current()

Dim c As Control

If Me.NewRecord Then
    For Each c In Me.Detail.Controls
        If c.ControlType = acTextBox Or c.ControlType = acComboBox Or
c.ControlType = acCheckBox Then
            c.Enabled = True
            c.Locked = False
        End If
    Next c
    Me.AllowDeletions = True
    Me.InvOrder.Enabled = True
Else
  For Each c In Me.Detail.Controls
        If c.ControlType = acTextBox Or c.ControlType = acComboBox Or
c.ControlType = acCheckBox Then
            c.Enabled = False
            c.Locked = True
        End If
    Next c
    Me.AllowDeletions = False
    Me.InvOrder.Enabled = False
    End If
------------------------------- end ------------------------------------

and I enable control try edit button and code is this :


--------------------------- start code --------------------------
Private Sub cmdEditMode_Click()

If Me.EmployeeID.Column(1) <> ap_GetUserName() Then
Me.EmployeeID = txtUsername
End If
 Dim c As Control

    For Each c In Me.Detail.Controls
        If c.ControlType = acTextBox Or c.ControlType = acComboBox Or
c.ControlType = acCheckBox Then
            c.Enabled = True
            c.Locked = False
        End If
    Next c
    Me.AllowDeletions = True
    Me.InvOrder.Enabled = True
Me.cmdEditMode.Caption = "Edit Mode On"
End Sub
------------------ end -----------------------
only what i need is to make error handler

thanks


-----Original Message-----
From: Amy Wyatt [mailto:amyw@c...]
Sent: Wednesday October 2002 17:15
To: Access
Subject: [access] Re: Enable controls


To disable the controls in only the detail section you would need to set
Enabled property of each control.

Hope this helps,

Amy



> Hi all,
How to enable/disable controls in detail of form try edit button was trying
with Me.AllowEdits and Me.AllowAdditions but on this way is disabled tree
combobox in Header of form.


Message #4 by Lonnie Johnson <prodevmg@y...> on Wed, 30 Oct 2002 10:00:59 -0800 (PST)
Or you could try something like this...
 
Private Sub MyButton_Click()
Dim ctl As Control
For Each ctl In Me.Detail.Controls
    If ctl.ControlType = acTextBox Then
    
        ctl.Enabled = False

    End If
    
Next

End Sub

 

I hope this helps...

 


 

 Amy Wyatt <amyw@c...> wrote:To disable the controls in only the detail section you would need to set 
Enabled property of each control.

Hope this helps,

Amy



> Hi all,
How to enable/disable controls in detail of form try edit button was trying
with Me.AllowEdits and Me.AllowAdditions but on this way is disabled tree
combobox in Header of form.


Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Let me build your next MS Access database application. 





---------------------------------
Do you Yahoo!?
HotJobs - Search new jobs daily now

  Return to Index