By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,773 Members | 2,307 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,773 IT Pros & Developers. It's quick & easy.

I typed in a text field of a new record, and now I can't delete it...

P: 2
Hi. I have a form with three fields:
OWNER - Default is user login
DATE_TIME - Default is Now()
Neither of the above can the user change.

The last field is a long text / memo field, WORK_NOTES, that the user can update.

Unfortunately, sometimes they will go to type something in and then change their mind. When they delete everything in the field, the form still tries to save something, I'm assuming because once I type something in this field the other two fields become.... active? I don't know.

I have tried the following with no success:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. If Len(Me.WORK_NOTES.Text) = 0 Then
  3.   Me.Undo
  4.   Canel = True
  5. End If
  6. End Sub
This did nothing for me at all. Only by clicking the undo arrow can I first see what I had typed, and then clicking it again shows a blank form I can escape from.
Aug 25 '17 #1

✓ answered by NeoPa

You have a typo in your code at line #4. From which I assume you need to see Require Variable Declaration.

Share this Question
Share on Google+
3 Replies


NeoPa
Expert Mod 15k+
P: 31,417
You have a typo in your code at line #4. From which I assume you need to see Require Variable Declaration.
Aug 25 '17 #2

P: 2
Thanks NeoPa. I'm under the assumption that "Cancel as Integer" in line 1 is the variable declaration. Is that incorrect?
Aug 28 '17 #3

NeoPa
Expert Mod 15k+
P: 31,417
Yes. That's correct. Setting Cancel to True is also perfectly valid, but setting Canel certainly isn't.

If you followed the link you'll have seen recommendations that would set up your project such that similar typos would be caught a long time before you could post such a question. It will save you from loads of such issues if you let it. I can hardly overstress the importance of this one point.

Good luck.
Aug 28 '17 #4

Post your reply

Sign in to post your reply or Sign up for a free account.