Connecting Tech Pros Worldwide Forums | Help | Site Map

Writing values from unbound controls after record navigation in subform

planetthoughtful
Guest
 
Posts: n/a
#1: Apr 14 '06
Hi All,

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

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,

planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org


planetthoughtful
Guest
 
Posts: n/a
#2: Apr 14 '06

re: Writing values from unbound controls after record navigation in subform


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,

planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org

Closed Thread


Similar Microsoft Access / VBA bytes