here's an easy one. i just created a little form where i hide some controls based on a selection made in a combo box. he's the code:
Private Sub RequirementType_BeforeUpdate(Cancel As Integer)
If (Me.RequirementType <> "Recordkeeping Requirement") Then
Me.RecordkeepingSource.Visible = False
Me.RecordLocation.Visible = False
Me.RecordRetentionTime.Visible = False
End If
End Sub
everything works alright, but originally i had placed the statement:
Cancel = True
before closing the If statement. when i did this Access locked me in the RequirementType field after making my selection. In a previous application where i was doing some data validation i was advised to use the "Cancel = True" line to be safe.
e.g.
If (Me.Value1 > Me.Value2) Then
MsgBox "Value 1 cannot be greater than Value 2", vbExclamation
Me.Value1.undo
Cancel = True
End If
basically i'm not sure what the "Cancel = True" does and when should i use it. could someone explain this to me?
thanks a lot.
Private Sub RequirementType_BeforeUpdate(Cancel As Integer)
If (Me.RequirementType <> "Recordkeeping Requirement") Then
Me.RecordkeepingSource.Visible = False
Me.RecordLocation.Visible = False
Me.RecordRetentionTime.Visible = False
End If
End Sub
everything works alright, but originally i had placed the statement:
Cancel = True
before closing the If statement. when i did this Access locked me in the RequirementType field after making my selection. In a previous application where i was doing some data validation i was advised to use the "Cancel = True" line to be safe.
e.g.
If (Me.Value1 > Me.Value2) Then
MsgBox "Value 1 cannot be greater than Value 2", vbExclamation
Me.Value1.undo
Cancel = True
End If
basically i'm not sure what the "Cancel = True" does and when should i use it. could someone explain this to me?
thanks a lot.