SubForm Question

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

If a main form has a subform that displays three records, let's say PART1,
PART2, and PART3 - Is there a way to code a text box on the main form to
look for the value PART1 in that subform and then return that value to the
main form?

Thanks

Joe
 
Joe,

Yes, there is. The specifics will depend on which field(s) value you
want to display on the main form, and on what data distinguishes the
PART1 record from the others.
 
Hi Steve,

The main form is SALES, the subform is SALES DETAIL, which means that the
subform has a autonumber primary key and a number foreign key back to the
SALES table. So, PART1, PART2, and PART3 ia another field stored in the
SALES DETAIL table, but not the key.

So, knowing the structure, is there a way to accomplish this?

Thanks

Joe
 
Joe,

Well, I am still not quite sure what PART1 etc refers to, but anyway,
try this... Put an unbound textbox on the Sales form, with its Control
Source property set to the equivalent of...
=DFirst("YourField]","YourQuery")
.... assuming that the query that the subform is based on already has a
criterion in the "Number Foreign Key" field to select records according
to the primary key of the current Sales record. If you are relying
entirely on the subform's Link Master Fields and Link Child Fields
properties to select the related records, then the expression will need
to be something like this...
=DFirst("YourField]","YourQuery","[Number Foreign Key]=" & SalesID)
 
Back
Top