populate all records showing in a subform (1 Viewer)

karatelung

Registered User.
Local time
Today, 08:27
Joined
Apr 5, 2001
Messages
84
i'm trying to get all the records in a subform to equal [FosterID] on the main form. the following is in the onclick property of a command button:

[Forms]![frmFPRecruits]![frmIndRecruit]![FosterID] = Me.FosterID

when i click the button, the only record on the subform that gets its [FosterID] field populated is the first one. the others remain blank.

the master field is frmFPRecruits![Identification]; the child field is frmIndRecruit![RecruitID]

is it possible to fill [FosterID] for all the records in the subform?

Thanks
 

Travis

Registered User.
Local time
Today, 05:27
Joined
Dec 17, 1999
Messages
1,332
You will have to loop through the SubForms Recordset

Set rst=[Forms]![frmFPRecruits]![frmIndRecruit].RecordSet

Do While Not rst.EOF
rst!FosterID=Me.FosterID
rst.MoveNext
Loop

or

use an update Query with parameters.
 

karatelung

Registered User.
Local time
Today, 08:27
Joined
Apr 5, 2001
Messages
84
thanks.

I got the update query to do what I needed, but I also tried the code to see if that would work as well and got this error message concerning the first line of code:

Object doesn't support this property or method (Error 438)

an answer isn't necessary since the update query worked, but I am curious as to why I get this message. Do I need to check something in the references or something odd like that.
 

Users who are viewing this thread

Top Bottom