Unexpected event order with treeview control & subform

A

AliKwok

Hi all
Sorry about the previous failed cross-post!

I wonder if someone can think of a solution here:

Using Access XP

I have a form containing a subform and a treeview control.

I have code to respond to the tvcontrol NodeClick event by displaying the
data relevant to the node in the subform.

I also have code responding to the OnExit events of the subform's contols
(text & combo boxes) such that changes made are committed to the database.

Problem is: the tvcontrol's NodeClick event fires BEFORE the OnExit event
when a new node is clicked while the cursor is in one of the subform's
controls - which I didn't expect - hence the changes are made to the data
underlying the new node, insted of the intended one.

Ideas (including a fundamentally new approach)?

Thanks for any time you may spend thinking about this.

Ali
 
D

Dale Fye

Have you tried the LostFocus event of the subform? That should fire before
the NodeClick Event of the TreeView.
 
C

Chris C, UK

AliKwok said:
Hi all
Sorry about the previous failed cross-post!

I wonder if someone can think of a solution here:

Using Access XP

I have a form containing a subform and a treeview control.

I have code to respond to the tvcontrol NodeClick event by displaying the
data relevant to the node in the subform.

I also have code responding to the OnExit events of the subform's contols
(text & combo boxes) such that changes made are committed to the database.

Problem is: the tvcontrol's NodeClick event fires BEFORE the OnExit event
when a new node is clicked while the cursor is in one of the subform's
controls - which I didn't expect - hence the changes are made to the data
underlying the new node, insted of the intended one.

Ideas (including a fundamentally new approach)?

Thanks for any time you may spend thinking about this.

Ali
 
C

Chris C, UK

Hi,

In the treeview node even, you might try issuing a .refresh on the sub-form

- something like : me!subformcontrolname.form.refresh

Chris
 

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