Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bounding and Me.Undo problem

Status
Not open for further replies.

Crowley16

Technical User
Jan 21, 2004
6,931
GB
Hello...

In this form I've got some code which includes a Me.Undo command followed by a Me.RecordSource = "blah" command...

however when I go to change the values of the bound tbx, the changes are discarded, any ideas?

Tia

Procrastinate Now!
 
When does the me.undo get triggered?

Is it possible it is being triggered again after you have set the recordsource thereby removing your changes?

Theres not quite enough information here for me to understand, whats a tbx?

----------------------------------------
My doctor says that I have a malformed public duty gland and a natural deficiency in moral fibre and that I'm therefore excused from saving universes.
----------------------------------------
 
the whole thing is in ListBox_Click()

and the Me.Undo happens before the Me.RecordSource...
I use the Me.Undo to resett any previous recordsources, if I don't, it throws an error when I try to resett the recordsource

the whole thing is:

Code:
Private Sub lbxFoundTapes_Click()
   Me.Undo
      
   Me.RecordSource = "SELECT * FROM tblTapeInfo " & _
      "WHERE TapeID = '" & lbxFoundTapes & "'"
End Sub

Oh and a tbx is a TextBox...

Procrastinate Now!
 
I'm much more comfortable with the listbox' after update vs the on click. Perhaps you should also test whether there is a (valid) selection in the listbox?

Sometimes explicitly clearing the recordsource helps, and also perhaps a requery afterwards:

[tt]if me!lbxFoundTapes.listindex<>-1 then
me.undo
me.recordsource=vbnullstring
me.recordsource="blah..."
me.requery
end if[/tt]

Roy-Vidar
 
Lol...

I found the problem, and u were right Mute...

there was a me.Undo command in a Clear function I was using in another button somewhere that was resetting all my changes...

such a simple thing and I didn't spot it for so long...

Doh...

well, you know what they say: doing something right the first time give you job satisfaction, doing it wrong 100 times gives you job security :)

Thanks for all those who helped...

Procrastinate Now!
 
OK, so your pulling records based on whats selected in the list box, your then changing other fields on the record then moving onto another record based on whats selected the next time the listbox is clicked?

If thats what you are doing you need to add a save record in there to keep the changes you make otherwise the me.undo will always be triggered removing the changes you make.

----------------------------------------
My doctor says that I have a malformed public duty gland and a natural deficiency in moral fibre and that I'm therefore excused from saving universes.
----------------------------------------
 
oops, missed these extra posts, sorry :D

----------------------------------------
My doctor says that I have a malformed public duty gland and a natural deficiency in moral fibre and that I'm therefore excused from saving universes.
----------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top