Microsoft
Software
Hardware
Network
Question : How to Disable all textboxes, command buttons, combo boxes etc.. on form:
PROBLEM DESCRIPTION
Disable all textboxes, commcand buttons, comboboxes, tabs etc.... on the form
"frmProjects_NEW_VER1"
Until the user has entered both the Project name and Project number
WHAT I TRIED
I put this code in the form " "frmProjects_NEW_VER1" on the load event and it did not work:
Dim c As Control
On Error Resume Next
For Each c In Me.Controls
c.Enabled = c.Name = "ProjectName"
Next c
__________________________
__________
What do I need to do?
__________________________
__________
___
To recreate problem:
1. Log In
2. Clock 'New Project"
3. Notice that the user can enter all information on the
frmProjects_NEW_VER1 and click SAVE without entering the Project name or Project number.
Attachments:
With-Code-AHA-Builder-2010-VER-1.zip
(705 KB)
(Possible File Type Mismatch)
db
Deactivate-7-25-2010.jpg
(94 KB)
(File Type Details)
image
Answer : How to Disable all textboxes, command buttons, combo boxes etc.. on form:
Question 1. Do I replace the code I put in the ON OPEN EVENT with:
Private Sub VerifyNameAndNumber()
If Len(Me.ProjectName) > 0 And Len(Me.ProjectNumber) > 0 Then
Dim c As Control
For Each c In Me.Section(0).Controls
If c.ControlType = acTextBox Or c.ControlType = acCommandButton Then
'MsgBox c.Name
c.Enabled = True
End If
Next c
End If
No, don't you remember?
What did I post here 33293015 ?
Here is the entire post again:
<I think we need to add some code to disable the Comboboxes?>
Bingo!
So try this:
Private Sub VerifyNameAndNumber()
If Len(Me.ProjectName) > 0 And Len(Me.ProjectNumber) > 0 Then
Dim c As Control
For Each c In Me.Section(0).Controls
If c.ControlType = acTextBox Or c.ControlType = acCommandButton Or c.ControlType = acCombobox Then
'MsgBox c.Name
c.Enabled = True
End If
Next c
End If
;-)
No the $50,000 Dollar question is:
Can you adapt this to code *enable the comboboxes in the "VerifyNameAndNumber" sub procedure?
;-)
Jeff
\
Random Solutions
MsexchangeOma event id 1801
XSLT and RESTful Web Services
Firefox css border on inside of div when embedding Flash with SWFObject, why?
Urgent - Please Please Help - How can i check if someone has logged in to my account in Facebook and read my emails??
how can i create window service in C# using InstallUtil.exe ??
Outlook 2010 NK2 file
copy outlook express from one pc to new windows 7 pc into outlook 07?
Difference between Icefaces,myfaces,richfaces
in JSF?
Best AV for 2008 R2 64bit
UN's headquaters