sniffingvixen
Technical User
Hey all,
I just started using Access about two weeks ago and am managing for the most part. Just now though, I've been stumped.
I'm using the Function below to ensure that data entry doesn't occur out of order. In other words, additional fields aren't visible until the currently visible field(s) have data in them.
I call the function for each of the 10 fields in response to AfterUpdate and Change events. I also call it in response to the Form's Current event.
I have similar code for other fields that works well. The difference is that their visibility doesn't involve successive field references (e.g., check Field1 to decide on Field2, then check Field2 to decide on Field3, etc.).
The code below works well until I try to delete an entry.
Suppose:
Enter "Peru" into Area00, Area01 appears. (good!)
Enter "Italy" into Area01, Area02 appears. (good!)
But, delete "Italy" and Area02 remains visible. (BAD!)
I don't even know if the problem is with my code or my event references. Can anyone help?
Thanks,
j
Public Function CascadingAreaVisibility()
'Block 1
If Me.Area00 = "" Then
Me.Area01 = ""
Me.Area01.Visible = False
Else 'Block 2
Me.Area01.Visible = True
If Me.Area01 = "" Then
Me.Area02 = ""
Me.Area02.Visible = False
Else 'Block 3
Me.Area02.Visible = True
If Me.Area02 = "" Then
Me.Area03 = ""
Me.Area03.Visible = False
Else 'Block 4
Me.Area03.Visible = True
If Me.Area03 = "" Then
Me.Area04 = ""
Me.Area04.Visible = False
Else 'Block 5
Me.Area04.Visible = True
If Me.Area04 = "" Then
Me.Area05 = ""
Me.Area05.Visible = False
Else 'Block 6
Me.Area05.Visible = True
If Me.Area05 = "" Then
Me.Area06 = ""
Me.Area06.Visible = False
Else 'Block 7
Me.Area06.Visible = True
If Me.Area06 = "" Then
Me.Area07 = ""
Me.Area07.Visible = False
Else 'Block 8
Me.Area07.Visible = True
If Me.Area07 = "" Then
Me.Area08 = ""
Me.Area08.Visible = False
Else 'Block 9
Me.Area08.Visible = True
If Me.Area08 = "" Then
Me.Area09 = ""
Me.Area09.Visible = False
Else 'Block 10
Me.Area09.Visible = True
End If 'End Block 9
End If 'End Block 8
End If 'End Block 7
End If 'End Block 6
End If 'End Block 5
End If 'End Block 4
End If 'End Block 3
End If 'End Block 2
End If 'End Block 1
End Function
I just started using Access about two weeks ago and am managing for the most part. Just now though, I've been stumped.
I'm using the Function below to ensure that data entry doesn't occur out of order. In other words, additional fields aren't visible until the currently visible field(s) have data in them.
I call the function for each of the 10 fields in response to AfterUpdate and Change events. I also call it in response to the Form's Current event.
I have similar code for other fields that works well. The difference is that their visibility doesn't involve successive field references (e.g., check Field1 to decide on Field2, then check Field2 to decide on Field3, etc.).
The code below works well until I try to delete an entry.
Suppose:
Enter "Peru" into Area00, Area01 appears. (good!)
Enter "Italy" into Area01, Area02 appears. (good!)
But, delete "Italy" and Area02 remains visible. (BAD!)
I don't even know if the problem is with my code or my event references. Can anyone help?
Thanks,
j
Public Function CascadingAreaVisibility()
'Block 1
If Me.Area00 = "" Then
Me.Area01 = ""
Me.Area01.Visible = False
Else 'Block 2
Me.Area01.Visible = True
If Me.Area01 = "" Then
Me.Area02 = ""
Me.Area02.Visible = False
Else 'Block 3
Me.Area02.Visible = True
If Me.Area02 = "" Then
Me.Area03 = ""
Me.Area03.Visible = False
Else 'Block 4
Me.Area03.Visible = True
If Me.Area03 = "" Then
Me.Area04 = ""
Me.Area04.Visible = False
Else 'Block 5
Me.Area04.Visible = True
If Me.Area04 = "" Then
Me.Area05 = ""
Me.Area05.Visible = False
Else 'Block 6
Me.Area05.Visible = True
If Me.Area05 = "" Then
Me.Area06 = ""
Me.Area06.Visible = False
Else 'Block 7
Me.Area06.Visible = True
If Me.Area06 = "" Then
Me.Area07 = ""
Me.Area07.Visible = False
Else 'Block 8
Me.Area07.Visible = True
If Me.Area07 = "" Then
Me.Area08 = ""
Me.Area08.Visible = False
Else 'Block 9
Me.Area08.Visible = True
If Me.Area08 = "" Then
Me.Area09 = ""
Me.Area09.Visible = False
Else 'Block 10
Me.Area09.Visible = True
End If 'End Block 9
End If 'End Block 8
End If 'End Block 7
End If 'End Block 6
End If 'End Block 5
End If 'End Block 4
End If 'End Block 3
End If 'End Block 2
End If 'End Block 1
End Function