Greetings:
Hi All,
After some time I am back with some issues as below:
I have a table/form with the below fields:
1.Project under BIM = check box
2.Project Not under BIM = check box
3.As-built1 = Hyperlink
4.As-built2 = Hyperlink
5.As-built2 = Hyperlink, I need to activate the below:
a)If check “Project under BIM”, disable or if possible hide the “As-built1” from the form.
b)If check “Project Not under BIM”, disable or if possible hide the “As-built2” & “As-built3” from the form.
Thanks in advance for solving the above.
Regards,
VKKT
Disable/Hide a field based on the value of another filed
-
- 2StarLounger
- Posts: 184
- Joined: 13 Jun 2018, 07:50
-
- Administrator
- Posts: 78678
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Disable/Hide a field based on the value of another filed
Open the form in design view. Don't select anything on the form yet.
1) Activate the Event tab of the Property Sheet.
Click in the On Current event.
Select [Event Procedure] from the dropdown.
Click the builder dots ... to the right of the dropdown arrow.
Make the code look like this:
2) Select the check box Project under BIM.
Select [Event Procedure] from the dropdown.
Click the builder dots ... to the right of the dropdown arrow.
Make the code look like this:
3) Do the same with Project Not under BIM, with code
1) Activate the Event tab of the Property Sheet.
Click in the On Current event.
Select [Event Procedure] from the dropdown.
Click the builder dots ... to the right of the dropdown arrow.
Make the code look like this:
Code: Select all
Private Sub Form_Current()
Me.[As-built1].Visible = Me.[Project under BIM]
Me.[As-built2].Visible = Me.[Project Not under BIM]
Me.[As-built3].Visible = Me.[Project Not under BIM]
End Sub
Select [Event Procedure] from the dropdown.
Click the builder dots ... to the right of the dropdown arrow.
Make the code look like this:
Code: Select all
Private Sub Project_under_BIM_AfterUpdate()
Me.[As-built1].Visible = Me.[Project under BIM]
End Sub
Code: Select all
Private Sub Project_under_BIM_AfterUpdate()
Me.[As-built2].Visible = Me.[Project Not under BIM]
Me.[As-built3].Visible = Me.[Project Not under BIM]
End Sub
Best wishes,
Hans
Hans
-
- 2StarLounger
- Posts: 184
- Joined: 13 Jun 2018, 07:50
Re: Disable/Hide a field based on the value of another filed
Thanks a lot Mr. Hans for your support & solution as usual, it is working very well as required.
Regards,
VKKT
Regards,
VKKT
-
- 2StarLounger
- Posts: 184
- Joined: 13 Jun 2018, 07:50
Re: Disable/Hide a field based on the value of another filed
Greetings:
Hi Mr. Hans,
Now I noticed that the data is not saving with the changes I made (these fields only).
Below is the code:
Option Compare Database
Option Explicit
Private Sub Comments_AfterUpdate()
Me.CommentsClosed.Enabled = Not (Nz(Me.Comments, "") = "No comments")
End Sub
Private Sub Form_Current()
Me.CommentsClosed.Enabled = Not (Nz(Me.Comments, "") = "No comments")
Me.MajorComments.Enabled = Not (Nz(Me.Comments, "") = "No comments")
Me.[ABLink].Visible = Me.[ProjectunderBIM]
Me.[ABLink1].Visible = Me.[ProjectNotUnderBIM]
Me.[ABLink2].Visible = Me.[ProjectNotUnderBIM]
End Sub
Private Sub MajorComments_AfterUpdate()
Me.MajorComments.Enabled = Not (Nz(Me.Comments, "") = "No comments")
End Sub
Private Sub ProjectnotunderBIM_AfterUpdate()
Me.[ABLink].Visible = Me.[ProjectNotUnderBIM]
End Sub
Private Sub ProjectunderBIM_AfterUpdate()
Me.[ABLink1].Visible = Me.[ProjectunderBIM]
Me.[ABLink2].Visible = Me.[ProjectunderBIM]
End Sub
Hi Mr. Hans,
Now I noticed that the data is not saving with the changes I made (these fields only).
Below is the code:
Option Compare Database
Option Explicit
Private Sub Comments_AfterUpdate()
Me.CommentsClosed.Enabled = Not (Nz(Me.Comments, "") = "No comments")
End Sub
Private Sub Form_Current()
Me.CommentsClosed.Enabled = Not (Nz(Me.Comments, "") = "No comments")
Me.MajorComments.Enabled = Not (Nz(Me.Comments, "") = "No comments")
Me.[ABLink].Visible = Me.[ProjectunderBIM]
Me.[ABLink1].Visible = Me.[ProjectNotUnderBIM]
Me.[ABLink2].Visible = Me.[ProjectNotUnderBIM]
End Sub
Private Sub MajorComments_AfterUpdate()
Me.MajorComments.Enabled = Not (Nz(Me.Comments, "") = "No comments")
End Sub
Private Sub ProjectnotunderBIM_AfterUpdate()
Me.[ABLink].Visible = Me.[ProjectNotUnderBIM]
End Sub
Private Sub ProjectunderBIM_AfterUpdate()
Me.[ABLink1].Visible = Me.[ProjectunderBIM]
Me.[ABLink2].Visible = Me.[ProjectunderBIM]
End Sub