469,085 Members | 1,046 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,085 developers. It's quick & easy.

Writing values from unbound controls after record navigation in subform

Hi All,

I have a mainform with a subform in which I show some task summary

On the mainform I have a number of unbound controls that reflect values
relevant to each task in the subform. The unbound controls are
populated in the subform's OnCurrent even from a number of different
tables related to the records in tbl_tasks, which is the recordset
displayed in the subform.

My goal is that users should be able to change the values in the
unbound controls on the mainform, and then when the user navigates to
another record in the subform, the following should happen:

- determine if values in unbound controls on mainform have changed
(currently, I set the mainform's 'Dirty' property to true when any of
the unbound control values are changed)

- update the relevant tables to reflect changed values associated with
the 'navigated from' record

- retrieve and populate the unbound controls with the values associated
with the 'navigated to' record

I know I can achieve this by having the unbound controls uneditable
until an 'edit values' button is clicked, which I would use to disable
the subform. Then, when the user clicks 'save changes', I'd write the
values to the tables, disable the unbound controls again, and enable
the subform allowing navigation.

I'm just wondering is there's a way that simulates the feel of editing
values in a datasheet etc, where navigating to the next record
automatically writes any changes in the 'navigating from' record.

Any help appreciated!

Much warmth,

"Lost in thought"

Apr 14 '06 #1
1 2786
Not to worry, I think I worked this question out.

Essentially, I've put an unbound and invisible control on my mainform
which contains the task id of the record in my subform. In my subform's
OnCurrent event I check to see if the mainform is dirty, and if so I
perform the appropriate table updates using the values in the unbound
controls on the mainform. Once completed, I update the unbound controls
with the current record's values (including the task id of the current
record in the subform), ready to be updated etc, and set the mainform's
dirty property to false.

I don't know if this is going to run into event clash, but it seems
like it should address the issue.

Thanks to all.

Much warmth,

"Lost in thought"

Apr 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Tim Marshall | last post: by
3 posts views Thread by Dos Lil | last post: by
2 posts views Thread by dancole42 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.