P
Procyan
I have a main form with 3 sub forms on it each on different tabs. On the load
of the Parent form (frmaaMain) I have some fields on sub form (tblEnd) become
disabled. The code looks like this.
Option Compare Database
Option Explicit
Private Sub Form_Open(Cancel As Integer)
Me.Controls("tblEnd").Form.Controls("DateTime2").Enabled = False
Me.Controls("tblEnd").Form.Controls("Remarks2").Enabled = False
Me.Controls("tblEnd").Form.Controls("DateTime3").Enabled = False
Me.Controls("tblEnd").Form.Controls("Remarks3").Enabled = False
Me.Controls("tblEnd").Form.Controls("DateTime4").Enabled = False
Me.Controls("tblEnd").Form.Controls("Remarks4").Enabled = False
End Sub
I want the fields mentioned above to stay disabled until a certain event
happens. Example. On the AfterUpdate of Remarks1 text field If there is data
in the field that would unlock DateTime2 and Remarks2, and if there was data
in Remarks2 then DateTime3 and Remarks3 would open up. Following is the code
for that.
Option Compare Database
Option Explicit
Private Sub Remarks1_AfterUpdate()
If IsNull(Me.Remarks1) = False Or Me.Remarks1 <> " " Then
Me.Remarks2.Enabled = True And Me.DateTime2.Enabled = True
Else
Me.Remarks2.Enabled = False And Me.DateTime2.Enabled = False
End If
End Sub
I believe the code to be correct but it never works. I have also tried
..Visible and .Locked. Visible didn't work just like Enabled. Locked worked
but I would prefer to use Enabled. What do I have wrong in my code or do I
have a wrong option somewhere? Thanks in advance to anyone that contributes.
Michael
of the Parent form (frmaaMain) I have some fields on sub form (tblEnd) become
disabled. The code looks like this.
Option Compare Database
Option Explicit
Private Sub Form_Open(Cancel As Integer)
Me.Controls("tblEnd").Form.Controls("DateTime2").Enabled = False
Me.Controls("tblEnd").Form.Controls("Remarks2").Enabled = False
Me.Controls("tblEnd").Form.Controls("DateTime3").Enabled = False
Me.Controls("tblEnd").Form.Controls("Remarks3").Enabled = False
Me.Controls("tblEnd").Form.Controls("DateTime4").Enabled = False
Me.Controls("tblEnd").Form.Controls("Remarks4").Enabled = False
End Sub
I want the fields mentioned above to stay disabled until a certain event
happens. Example. On the AfterUpdate of Remarks1 text field If there is data
in the field that would unlock DateTime2 and Remarks2, and if there was data
in Remarks2 then DateTime3 and Remarks3 would open up. Following is the code
for that.
Option Compare Database
Option Explicit
Private Sub Remarks1_AfterUpdate()
If IsNull(Me.Remarks1) = False Or Me.Remarks1 <> " " Then
Me.Remarks2.Enabled = True And Me.DateTime2.Enabled = True
Else
Me.Remarks2.Enabled = False And Me.DateTime2.Enabled = False
End If
End Sub
I believe the code to be correct but it never works. I have also tried
..Visible and .Locked. Visible didn't work just like Enabled. Locked worked
but I would prefer to use Enabled. What do I have wrong in my code or do I
have a wrong option somewhere? Thanks in advance to anyone that contributes.
Michael