Hi All
I have a form named "Frmsearch" and there is a listbox so on the double click event of the listbox , another form will open with all the data relevant to item selected from the listbox.
Now I want to check if Saved field is True and if yes then make all the controls disabled. The checkbox named "chkSaved" has a control source "Saved".
Now the thing is If I write the code in Form Current event then it works but In Form Open event it doesn't.
but when I write the code in Form open event then it doesn't work?It doesn't disable the controls and gives me "False" in the message box.
ANy help will be much appreciated.
Thanks.
I have a form named "Frmsearch" and there is a listbox so on the double click event of the listbox , another form will open with all the data relevant to item selected from the listbox.
Now I want to check if Saved field is True and if yes then make all the controls disabled. The checkbox named "chkSaved" has a control source "Saved".
Now the thing is If I write the code in Form Current event then it works but In Form Open event it doesn't.
Code:
Private Sub Form_Current()
Dim ctr As Control
If Me.chkSaved = True Then
MsgBox "True"
For Each ctr In Me.Controls
' MsgBox (ctr.Name & " " & ctr.Tag)
If ctr.Tag = "C" Then
ctr.Enabled = False
End If
Next ctr
Else
MsgBox "False"
End If
End Sub
but when I write the code in Form open event then it doesn't work?It doesn't disable the controls and gives me "False" in the message box.
Code:
Private Sub Form_Open(Cancel As Integer)
Dim ctr As Control
If IsNull(Me.cboAgent) Then
Me.cboAgent = Forms!frmFormCatalogue!cboStaff
End If
If Me.chkSaved = True Then
MsgBox "True"
For Each ctr In Me.Controls
' MsgBox (ctr.Name & " " & ctr.Tag)
If ctr.Tag = "C" Then
ctr.Enabled = False
End If
Next ctr
Else
MsgBox "False"
End If
End Sub
ANy help will be much appreciated.
Thanks.