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 / SQL Server / ADP / October 2005

Tip: Looking for answers? Try searching our database.

unbound control; undo doesn't work!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sag73 - 02 Oct 2005 11:12 GMT
Hi all,

A2K3/ SQL2K/ ADP

Got a form which is bound to a SP. The aim is to be able to search for
records based on either the ID or the person name. I have therefore made
these two controls invisible and added two unbound controls which get
updated from the invisible controls by the "On Current " event. The aim of
the unbound controls is to be able to type values therein and the "Before
Update" and "After Update" events fire the search which displays the
appropriate record in the form or shows a popup form to select "near
matches" (the name is searched using 'Like %search criteria%'). Before Event
validates data entry in the unbound controls beofre allowing After Event to
perform the search and display the record if a match is found.

Problem is, if no match is found or invalid data is entered, I try to use:

Private Sub txtName_BeforeUpdate(Cancel as Integer)
If (sinlge match found) Then
   (display record data in Form)
elseif (multiple matches found) then
   (display selection form)
   (display selected record in form)
else
   Cancel=True
   Me.txtName.Undo
end if

in Before Update but no matter what, the entry is not being undone in the
control. Any help greatly appreciated.
RuralGuy - 02 Oct 2005 11:59 GMT
AFAIK Undo does *not* work with unbound controls.  It only makes sense since
what value would you expect Access to restore it to?  When bound the Undo will
restore to the value in the table.  You will need to roll your own Undo to get
the feature.  The Tag property is available and OldValue might even be
read/write.  

>Hi all,
>
[quoted text clipped - 26 lines]
>in Before Update but no matter what, the entry is not being undone in the
>control. Any help greatly appreciated.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
Sag73 - 02 Oct 2005 17:38 GMT
Thanks for that RuralGuy and sorry I did not realise that.
I haven't had a lot of success with OldValue but I'll try to investigate.

> AFAIK Undo does *not* work with unbound controls.  It only makes sense since
> what value would you expect Access to restore it to?  When bound the Undo will
[quoted text clipped - 36 lines]
> hth - RuralGuy (RG for short)
> Please post to the NewsGroup so all may benefit.
Vadim Rapp - 03 Oct 2005 20:23 GMT
Hello RuralGuy:
You wrote  on Sun, 02 Oct 2005 04:59:28 -0600:

R> AFAIK Undo does *not* work with unbound controls.  It only makes sense
R> since what value would you expect Access to restore it to?  When bound
R> the Undo will restore to the value in the table.  You will need to roll
R> your own Undo to get the feature.  The Tag property is available and
R> OldValue might even be read/write.

without even looking, I bet oldvalue won't work for the same reasons as you
mentioned.

Vadim
RuralGuy - 04 Oct 2005 03:34 GMT
Thanks Vadim,
You got me curious so I did some testing.  OldValue is Read Only in all views
whether the control is bound or not.  When the control is UnBound then OldValue
follows Value.  So you are correct that OldValue will not work here.  But the
Tag property is still available and would work for rolling your own UnDo.

>Hello RuralGuy:
>You wrote  on Sun, 02 Oct 2005 04:59:28 -0600:
[quoted text clipped - 9 lines]
>
>Vadim

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
Sag73 - 04 Oct 2005 17:30 GMT
Hi Vadim & RG

Well I guess your analysis / presumption are correct. However, RG's pointer
on trying to use OldValue has helped me.

As the unbound controls derive their value from the bound controls, I have
used the OldValue of the bound controls to 'roll-back' the value of the
unbound controls when no search criterion is met.

Thanks for pointing me in the good direction.

> Thanks Vadim,
> You got me curious so I did some testing.  OldValue is Read Only in all views
> whether the control is bound or not.  When the control is UnBound then OldValue
> follows Value.  So you are correct that OldValue will not work here.  But the
> Tag property is still available and would work for rolling your own UnDo.
RuralGuy - 04 Oct 2005 22:36 GMT
That's what I like to hear, success!  Good Job.

>Hi Vadim & RG
>
[quoted text clipped - 19 lines]
><vrapp@nospam.polyscience.com>
>> wrote:

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
Vadim Rapp - 06 Oct 2005 05:32 GMT
Hello RuralGuy,
You wrote in conference
microsoft.public.access.adp.sqlserver,microsoft.public.access.forms,microsoft.public.access.formscoding
on Mon, 03 Oct 2005 20:34:55 -0600:

VR> without even looking, I bet oldvalue won't work for the same
VR> reasons as you mentioned.

R> You got me curious so I did some testing.

which means you accepted the bid. As an old mainframe game was saying 25
years ago, "you lost $10, please put them into the punchcard reader".

:)))
RuralGuy - 06 Oct 2005 14:46 GMT
lol, you caught me.  $'s inserted.

>Hello RuralGuy,
>You wrote in conference
[quoted text clipped - 10 lines]
>
>:)))

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
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.