generate an ID for a record in a subform based on main form ID

G

Guest

I have a parent form with a field TravelerName and another field FrameQty.
I also have a continous subform for tracking InspectionCodes for PartNumbers.
What I would like to be able to do is that when the TravelerName and FrameQty
are entered in the parent form, associated records are created in the subform.
For example:
When TravelerName(unique) = F6070913 and FrameQty = 6
then I want to populate subform PartInspections(based on tblParts)
with PartNumbers; F6070913A,F6070913B,F6070913C,F6070913D,F6070913E,
and F6070913F.
Or
If TravelerName(unique) = F6070913 and FrameQty = 4
then I want to populate subform PartInspections(based on tblParts)
with PartNumbers; F6070913A,F6070913B,F6070913C,and F6070913D.

If someone has some ideas or examples on how to get this done I appreciate the
help, my coding skills are very limited.
 
G

Guest

a couple approaches possible;

when you insert a new subform into a main form the wizard launches and part
of that set up you can set it so the subform data is linked to the main form
data....thus as you select a main record only the linked subform data
shows....

but if you need to filter the subdata further based on values within the
main record; rather than just the main record's id alone.... then another
approach is to set the subform's data to be sourced off a query.

make that query's criteria dependent upon values found on the open main form
by referencing the specific form's controls in the query design.

again, if the values in the main form are specific to each record then the
subform based upon the query will always pull up the right data whenever you
change records in the main form......if you plan the user to variably select
data within a record in the main form then you must trigger that subform to
reopen in order to requery with those values....
 
G

Guest

thanks NTC,
I have the form/subform linked via tblTrav.TravelerID(autonumber) and
tblParts.PartID(AutoNumber)but right now the user manually enters the
PartNumber(s) in the subform and what I would like to happen instead is that
Access generates the PartNumber based on the TravelerName in the main form.
If TravelerName(unique) = F6070913 and FrameQty = 4
then I want to insert into tblParts-PartNumbers "F6070913A", "F6070913B",
"F6070913C", and "F6070913D".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top