AutoFill for Sub Form

J

J. Trucking

Hello,

I just have a quick question. I have a form that is linked to a table
which stores a bunch of information about different pieces of
machinery (1 record for each machine). On this form, I have a subform
which holds information regarding a parts list for each piece of
machinery. I have the parts list as a subform because the parts for
each machine will be different (ie) the parts for a dump truck will be
different from that of a bulldozer. However, there will be some part
items that will overlap such as oil filters, fuel filters, air filters
etc.

My question is: is there a way to default in 3 or 4 records on each
subform, but just on one field. In my subform, I have the fields
PartID, PartName, Supplier, PartNumber, Notes, and FleetID. FleetID
is the field that links my form with my subform. What I would like to
be able to do, is when a new piece of machinery is created on the
form, the subform already has OIL FILER, AIR FILTER, FUEL FILTER, etc.
already listed in the PartName field while leaving Supplier,
PartNumber, and Notes blank. So, for example, if I added a machine
called "service truck", I could look at the subform and see "OIL
FILTER, AIR FILTER, and FUEL FILTER" in the PartName column, and all I
would have to do is add the PatNumber, the Supplier, and any Notes I
wanted. My subform is on Datasheet View.

Just wondering if this is possible. I need to keep the subform this
way (expandable) because the different types of machinery will warrant
slightly different parts lists (also in case I forget to add a part, a
user can come in and add it).

Thanks in advance for any help.

John
 
J

John W. Vinson

Just wondering if this is possible. I need to keep the subform this
way (expandable) because the different types of machinery will warrant
slightly different parts lists (also in case I forget to add a part, a
user can come in and add it).

You can run an Append query of the "standard list" of parts; I'd suggest
running it from a command button on the form (or *perhaps* from the GotFocus
event of the subform).

John W. Vinson [MVP]
 
J

J. Trucking

Hey John,

Thanks for the help. Would you be able to give me some pointers on
how to set one of those up. I've set up regular queries before...are
these the same?

Thanks
 
J

John W. Vinson

Hey John,

Thanks for the help. Would you be able to give me some pointers on
how to set one of those up. I've set up regular queries before...are
these the same?

Thanks
You would start with a regular select query. You might want to add a Yes/No or
other type of field (equipment category perhaps) in the Parts table so that
you can select that subset of parts which are to be included as "default"
parts.

Create a regular Select query choosing those records. Change it to an Append
query by using the Query menu option, or the query type tool on the toolbar.
You'll be asked which table you want to append the records to.

The query can be launched from VBA code using the RunQuery method - see the
online help.

John W. Vinson [MVP]
 

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