Harry Taylor
Registered User.
- Local time
- Today, 13:01
- Joined
- Jul 10, 2012
- Messages
- 91
I hope someone may be able to help.
I've written my first bit of VBA code (not sure how, but I got there).
Basically I want to copy the Telephone field text to the Microsoft clipboard when I click in the field.
Private Sub Telephone_GotFocus()
Telephone.SelStart = 0
Telephone.SelLength = Len(Me.FieldName)
End Sub
Private Sub Telephone_Click()
Telephone.SelStart = 0
Telephone.SelLength = Len(Me.Telephone)
DoCmd.RunCommand acCmdCopy
End Sub
The above code works, but when I click an empty cell I get an error.
How do I say 'if the field is empty do nothing'
Thank you
I've written my first bit of VBA code (not sure how, but I got there).
Basically I want to copy the Telephone field text to the Microsoft clipboard when I click in the field.
Private Sub Telephone_GotFocus()
Telephone.SelStart = 0
Telephone.SelLength = Len(Me.FieldName)
End Sub
Private Sub Telephone_Click()
Telephone.SelStart = 0
Telephone.SelLength = Len(Me.Telephone)
DoCmd.RunCommand acCmdCopy
End Sub
The above code works, but when I click an empty cell I get an error.
How do I say 'if the field is empty do nothing'
Thank you
