Advise on 'How to do'

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with several text boxes and contain text only. Each row of text
boxes is enabled or disabled depending on the related Yes/No check box.

What I want to do is this....

If the user un-checks the y/n box, then (after confirming they want to do
this) delete all the text contained within those text boxes, so that when the
record is saved, any text boxes that had text in them, will now be saved
without any text.

I have the code working for the prompt to do this, and for deleting the text
in the boxes, but when I click save, then data is not deleted.


Thanks in advance....
 
assuming that the textboxes in question are bound to fields in the form's
RecordSource, try the following code in the checkbox's Click event procedure
(or in the AfterUpdate event procedure), as

If Me!CheckboxName = False Then
If MsgBox("Do you want to delete this data?, _
vbYesNo) = vbYes Then
Me!FirstTextboxName = Null
Me!SecondTextboxName = Null
Me!ThirdTextboxName = Null
End If
End If

substitute the correct names of the controls, of course.

hth
 
Back
Top