Hello!
I have a small piece of code, which when the user selects a value from a drop down list (field A), if that value is "other", the information from another list (field B)is pasted in the comments box when the comments box gets the focus. They can then add any further information into the comments box if need.
However, if the user then goes back to the comments box later to add some more info to the comments box, the value from the field b is pasted into the comments box again, therefore loosing any of the additional information they may have entered originally.
My code is:
Private Sub COMMENTS_GotFocus()
If Me!MATERIAL = "other" Then
Me!COMMENTS = Me!WA_FINDTYPE
ElseIf Me!MATERIAL = "metal" Then
Me!COMMENTS = Me!WA_FINDTYPE
ElseIf Me!COMMENTS = Not Null Then
DoCmd.cancel event '(something wrong here!!)
Else
End If
End Sub
Basically, how do I prevent the code from running if the comments box has information in it? I thought that the not null - cancel event would work but it doesnt!
I am a pretty novice VBA type, so please any help would be gratefully received!!
Many thanks
I have a small piece of code, which when the user selects a value from a drop down list (field A), if that value is "other", the information from another list (field B)is pasted in the comments box when the comments box gets the focus. They can then add any further information into the comments box if need.
However, if the user then goes back to the comments box later to add some more info to the comments box, the value from the field b is pasted into the comments box again, therefore loosing any of the additional information they may have entered originally.
My code is:
Private Sub COMMENTS_GotFocus()
If Me!MATERIAL = "other" Then
Me!COMMENTS = Me!WA_FINDTYPE
ElseIf Me!MATERIAL = "metal" Then
Me!COMMENTS = Me!WA_FINDTYPE
ElseIf Me!COMMENTS = Not Null Then
DoCmd.cancel event '(something wrong here!!)
Else
End If
End Sub
Basically, how do I prevent the code from running if the comments box has information in it? I thought that the not null - cancel event would work but it doesnt!
I am a pretty novice VBA type, so please any help would be gratefully received!!
Many thanks