Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Picking from a subform

Status
Not open for further replies.

McFestoe

Technical User
Dec 16, 2003
145
GB
Iam trying to setup a order database to keep track of my stock, so far i have got all the relevant information in, now what i cant seam to be able to do is, i have a form that has a sub form on it that lists all the equipment we use and this is where i want to pick equipment from, now is there a way to pick from a subform and populate another subform and then be able to edit this subform for quanties etc.

Any pointers,
 
Hi!

The general format for accessing a control on a subform is:

Forms!YourMainForm!YourSubFormCONTROLName.Form!YourControlName.Property

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Let us say that you have a field ProductID on the equipment form. Let us say that the second subform is set up with link child and master fields and is called OrderDetail Subform. Add a click event to the ProductID in the equipment subform, like so:
Code:
Private Sub ProductID_DblClick(Cancel As Integer)
    Me.Parent.[OrderDetail Subform].SetFocus
    DoCmd.GoToRecord , , acNewRec
    Me.Parent.[OrderDetail Subform].Form.ProductID = Me.ProductID
End Sub
 
Have a button on your form that will copy whatever record is the current record, the record with the triangle on the left side (or pencil if editing data), and copy that record into the table that is populating the second subform. Or just copy the needed fields to that second table. This would best be done with a query, selecting on the key value(s) of the current record. To reference the current record, all you need to do is use the syntax of Me!fldName1, Me!fldName2 etc. The active record is the record whos fields you are referencing when using this syntax. The only way to get at other records values is to make the other record the current record. Usually this is done by the user moving the cursor in the User Interface.

What I'm assuming is that you have all your equipment showing in the first subform, and you want to pick only some of that equipment for shipment, movement, or whatever. Therefore, you want a second subform to display this smaller grouping of your equipment, and in the form of this smaller group, you need to add some quantities or whatever. So you will be, I think, dealing with two tables, tblEquipment and tblEquipmentToBeMoved (or whatever name).

HTH
Vic
 
Thanks

Given me a starting point, will try the various options.

Thanks again
 
How are ya McFestoe . . .

Have a look at MultiSelect Listbox, instead of the form!

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top