Autofill tabular subform

skwilliams

Registered User.
Local time
Yesterday, 21:51
Joined
Jan 18, 2002
Messages
516
I would like to automatically fill a field in each record of a subform with data in other field.

For example, the subform contains fields (field1 and field2) and field2 is populated with two records. I would like the date from the main form to populate field1 of those two records in the subform.

I've tried the Forms!Mainform!Subform1.Form.Field1=Me.dtDate

However, this only fills field1 of the first record.

Any ideas??

Thanks.
 
Set the Record Source of your subform to whatever table or query you are trying to get data from. Then edit your subform so instead of field1 and field2 you have the references to your Record Source field names.
 
The subform references the table that contains field2 already. But field1 data would need to be pulled from a field on the main form.

Attached is a screenshot in a word document of the form to better illustrate the problem.

dtDate is entered on the main form. A chemical is selected from the combo box which pulls various information about it from other tables. The subform displays the chemicals hazardous ingredients. A chemical may have one or many ingredients.

During this chemical selection event, each ingredient that gets displayed for that chemical will also receive the date in it's date field from the main forms date field.
 

Attachments

Can you reference back to your subform source table and store your values in there with something like:

With tbl1
.AddNew
!Date = Me!Date
!Chemical = Me!Chemical
.Update
End With

Hope that helps

-Jake
 
This database is becoming so complex that I've decided to redesign it from scratch.

Fortunately, I wasn't very far along.

Thanks for your help anyway!
 

Users who are viewing this thread

Back
Top Bottom