Checking if textbox values have been cleared or replaced, or updated

I

ILCSP

Hello, I have this textbox in a Access 2000 form, which is a memo type
where we keep our notes for a record. Whenever there's new notes to
add, they're piggied back to the existing notes. (new notes are
entered at the end of the last notes).

Lately, some of the existing notes have been deleted and I would like
to know if I could check if the notes have been cleared or replaced
with new ones before updating the record. I'm thinking of having 2
boxes, BoxA and BoxB. Both would start the same when the record's
loaded. However, BoxA would be visible and that's where the users would
make changes. BoxB would be invisible and for checking purposes only.

First, whenever a record needs to be updated, I would like to check if
the notes have been deleted altogether. That's easy to do:
if not isnull(BoxB) and is null(BoxA) then sound the alarm.

The problem would arise when someone clears the notes and puts new
ones. Then, both boxes are not null. Is there a way to check if the
value from boxB still exists in BoxA at the beggining of the BoxA's
value?

This should work like this. If someone add new notes to the existing
notes, then the BoxB value would be equal to the value of BoxA plus any
new notes. If they're not, I'd offer the user the chance to reset the
record, or let them go ahead with these changes if they really need to.

If anybody has comments on how to do this, please let me know.

A million thanks beforehand.
 
T

tina

not sure what your goal is. do you want to allow users to add new notes, but
prevent any existing notes from being deleted? or do you want to allow users
to delete existing notes?
 
I

ILCSP

Hi Tina, I first want to allow users to add notes without deleting the
existing ones. However, If they by some important reason they need to
clear those existing notes, then I would like to offer them the chance
to first think what they're gonna do and then offer them to delete them
if they need to.

This would not be the norm. Usually, 99.9% of the time they should not
delete the existing notes.

Thanks.
 
T

tina

suggest the following: in the form, keep the existing textbox control
that's bound to the Memo field in the underlying table. set the control's
Locked property to Yes and Tabstop property to No.

now the user can see existing notes, scroll through them to read them, and
even highlight all or part of the text if s/he wants to copy it - but the
user cannot edit or delete the existing notes.

add another textbox control to the form, and *leave it unbound*. this is
where the user can enter notes for this record, whether or not there are
existing notes already. in the form's BeforeUpdate event procedure, add the
following code, as

If Not IsNull(Me!UnboundTextboxName) Then
Me!NotesFieldName = Me!NotesFieldName & vbCrLf & vbCrLf &
Me!UnboundTextboxName
End If

so new notes entered in the unbound textbox control, are automatically added
to the Notes field in the form's underlying table - without disturbing any
existing notes.

to allow the user to delete any or all of the existing notes, add a command
button to the form. in the button's Click event procedure, add the following
code, as

Me!BoundNotesControlName.Locked = False
Me!BoundNotesControlName.SetFocus

in the bound Notes control's BeforeUpdate event procedure, add the following
code, as

If MsgBox("The notes have been changed or deleted. Do you want to
continue?", vbYesNo, "Verify changes") = vbNo Then
Cancel = True
Me!BoundNotesControlName.Undo
End If

in the form's Current event procedure, add the following code, as

Me!BoundNotesControlName.Locked = True

now the user can click the command button to unlock the "existing" notes
control, and edit/delete them at will. before the control is updated, the
user has a chance to cancel the changes, or continue. and when s/he moves to
another record, the control is automatically re-locked.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top