C
CES
All,
I can't seem to get ".SetFocus" and ".Dropdown" to play nicely with one another.
I have a general function that Enables/Disables a Form Field. Which is called using the onExit Event Property (I've tried Lost Focus,Got Focus Events as well and that causes the same problem), of the Field Element.
The problem that I am running into is that I can't call the function prior to leaving the field because if I do,it will throw an error. So I need to SetFocus to the another field, prior to calling the function.
However, when I do that the dropDown property ceases to work properly, it drops down for a brief moment and then rolls back out.
If anyone has a clue as to how to get this to work properly, I would appreciate any advice or guidance. Thanks in advance.- CES
Fields list in Tab Order:
' ClientId - Combo
' DateOfInvoice - This field has been Disabled and Locked
' ApplyTo - Combo
Public Function fnEnableDisableTxtBox(controlName As String, actionToTake As String)
' Call fnEnableDisableTxtBox("NameOfTextBox", "Disable or Null")
' Will Change to opposite of Current State
Dim tmp As Control
Set tmp = Me.Controls(controlName)
If actionToTake <> "Disable" Then
tmp.Enabled = True
tmp.Locked = False
tmp.BackStyle = 1
Else
tmp.Enabled = False
tmp.Locked = True
tmp.BackStyle = 0
End If
End Function
Private Sub ClientId_Exit(Cancel As Integer)
If Me.DateOfInvoice.Value <> "" Then
'Me.DateOfInvoice.SetFocus - Will throw an error because it's already been Locked & Disabled
'Me.ApplyTo.Dropdown - Will throw an error, most likely because it doesn't have focus yet
'Me.ApplyTo.SetFocus - Will not throw an error, however the menu doesn't drop down properly
' it will only drop down for a brief moment and then it roll back up.
'Me.ApplyTo.Dropdown - Will not throw an error,
Call fnEnableDisableTxtBox("ClientId", "Disable")
End If
End Sub
Private Sub ApplyTo_Enter()
Me.ApplyTo.Dropdown
End Sub
I can't seem to get ".SetFocus" and ".Dropdown" to play nicely with one another.
I have a general function that Enables/Disables a Form Field. Which is called using the onExit Event Property (I've tried Lost Focus,Got Focus Events as well and that causes the same problem), of the Field Element.
The problem that I am running into is that I can't call the function prior to leaving the field because if I do,it will throw an error. So I need to SetFocus to the another field, prior to calling the function.
However, when I do that the dropDown property ceases to work properly, it drops down for a brief moment and then rolls back out.
If anyone has a clue as to how to get this to work properly, I would appreciate any advice or guidance. Thanks in advance.- CES
Fields list in Tab Order:
' ClientId - Combo
' DateOfInvoice - This field has been Disabled and Locked
' ApplyTo - Combo
Public Function fnEnableDisableTxtBox(controlName As String, actionToTake As String)
' Call fnEnableDisableTxtBox("NameOfTextBox", "Disable or Null")
' Will Change to opposite of Current State
Dim tmp As Control
Set tmp = Me.Controls(controlName)
If actionToTake <> "Disable" Then
tmp.Enabled = True
tmp.Locked = False
tmp.BackStyle = 1
Else
tmp.Enabled = False
tmp.Locked = True
tmp.BackStyle = 0
End If
End Function
Private Sub ClientId_Exit(Cancel As Integer)
If Me.DateOfInvoice.Value <> "" Then
'Me.DateOfInvoice.SetFocus - Will throw an error because it's already been Locked & Disabled
'Me.ApplyTo.Dropdown - Will throw an error, most likely because it doesn't have focus yet
'Me.ApplyTo.SetFocus - Will not throw an error, however the menu doesn't drop down properly
' it will only drop down for a brief moment and then it roll back up.
'Me.ApplyTo.Dropdown - Will not throw an error,
Call fnEnableDisableTxtBox("ClientId", "Disable")
End If
End Sub
Private Sub ApplyTo_Enter()
Me.ApplyTo.Dropdown
End Sub