468,554 Members | 1,413 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Referencing main form recordset field?

This code from the subform works for getting the value of a field of
the main form named "WorkSheet":
MsgBox Form_WorkSheet.Recordset.Fields("Clerk").Value

Each record in the mainform datasheet called "WorkSheet" has a subform.
I am trying to get the controls on the subform to reference the fields
in the main form, because I think that it will resolve some of my write
conflict problems by not having a recordset for the subform, and
instead just referencing the Recordset of the main form.

Is there some syntax I can use in the "Control Source" property that
will let me access the "Clerk" field of the mainform's recordset? Or
can I get the same effect by assigning the recordset of the mainform to
the subform? I'm not sure how to do that. Or will I have to write
code into the subform controls' events like I posted at the beginning
to access each field individually?

Nov 13 '05 #1
3 2455
I hadn't thought of assigning the entire recordset until I had gotten
half way through writing the above post. It and it seems to work, but
it is querky in the way the subform fills in the data.

Should I be doing that in the onload or onopen event of the form?

One querk is that in a user editable textbox, the text from the
database doesn't appear until the user clicks in the textbox, and then
if they edit the text, click away from the textbox, the textbox reverts
back to the way it appeared before they edited it, but the editing IS
saved when the record is saved, and will show up next time the click in
the textbox.

Nov 13 '05 #2
Ok, this isn't working. In the subform I have:

Private Sub Form_Open(Cancel As Integer)
Set Me.Recordset = Form_WorkSheet.Recordset
End Sub

But each subform for each record displays the values of the currently
selected record, not of the record it is a subform of. So it seems the
recordset is not a set of records, but just a single record?

Nov 13 '05 #3
I gave up on this, as Access is doing so much junk behind the scenes
that I don't want it to that I felt like I had no control over the

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by William Wisnieski | last post: by
9 posts views Thread by William Wisnieski | last post: by
2 posts views Thread by jodyblau | last post: by
6 posts views Thread by kaosyeti | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.