Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ILCSP@NETZERO.NET - 21 Nov 2005 23:06 GMT
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.
tina - 22 Nov 2005 01:48 GMT
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?

> 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
[quoted text clipped - 25 lines]
>
> A million thanks beforehand.
ILCSP@NETZERO.NET - 22 Nov 2005 03:31 GMT
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.

> 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
[quoted text clipped - 29 lines]
> >
> > A million thanks beforehand.
tina - 22 Nov 2005 08:15 GMT
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

> 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
[quoted text clipped - 40 lines]
> > >
> > > A million thanks beforehand.
ILCSP@NETZERO.NET - 22 Nov 2005 16:35 GMT
Thanks Tina.  It worked great.
tina - 22 Nov 2005 20:53 GMT
you're welcome  :)

> Thanks Tina.  It worked great.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.