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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sync two sub-forms to same recordset?

Status
Not open for further replies.

NXMold

Technical User
Jul 22, 2008
104
I have a main form (mostly blank, no record source defined) with two sub-forms. These sub-forms are based on the same query, one form is a continuous datasheet, the other a more detailed view showing all fields.

Since the user can edit in either pane, I'm running into errors where the user edits the same record twice, at the same time. I think I need to bind these sub-forms to the same recordset, but I have no expierience with recordsets.

If on subform2 OnLoad I do:
Set me.recordset = forms!mainform!subform1.recordset
I get error 'object dosent support this property or method'

I wonder if I am making the reference prematurely, before the other forms are loaded. Or if I can even make that reference to a sub-form? Any tips?

Access 2000
 
not tested try

not sure if in access 2000 forms have a recordset property

dont think that you cam edit a form that is bound to a recordset

in the on load of the main form
Code:
Set me.subfrom2controlname.form.recordset = me.subfrom1controlname.form.recordset[code]

also try in the on exit of the subform control 

[code]

if me.subfrom1controlname.form.dirty = true then 
docmd.runcommand accmdsaverecord
end if
 
Hm, seems to take ok, but dosent solve my error. I should elaborate, data entry on each subform works fine, changes are reflected in each form as you change records. I think my problems is not what I described (though sharing the recordset should improve performance, no?)

The query is based on three tables, with a 'job#' field tying them all together. It is this field that causes errors when edited,

"This record has been changed by another user since you started editing it...... save, copy to clipboard, drop changes"

No other users in the database. Only happens when editing the job# field. The contorl for this field on each form is tied to the master table which has 1:1 relationships with the same field in the other tables.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top