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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box lookup on a subfrom

Status
Not open for further replies.

rlmorgan

Technical User
Jun 2, 2006
32
US
I have a main form called “frmParts” and a subform call “frmPartSub”. I have two combo boxes on the frmParts that lookup the parts in question using different fields in the record. This in turn fills in the subform. I need a 3rd combo box to look up records that are in the subform. Can this be done and if so how?

I have tried the following in various combinations to no avail:

Private Sub cboFindRMA_AfterUpdate()
Dim rs As Object

Forms!frmParts!frmPartsSub.SetFocus
Forms!frmParts!frmPartsSub.Form!RMA_DPS.SetFocus

Set rs = Me.Recordset.Clone
rs.FindFirst "[RMA_DPS] = '" & Me![cboFindRMA] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub
 
To access details on the subform, use

frmPartsSub.Form.RecordsetClone!Field1 - and then access it as you would any other recordset object in a read only manner.

If your data are structured in such a way that there can only be one record on the subform (which doesn't seem to be the case here given that you want a combo box) then you can just access the control required:

frmPartsSub.Form!txtField1

John
 
I need to be able to edit the recordset in the subform if possable. Once the subform recordset has been found, I would like to use a command button to add the current date using the following:

Private Sub cmdReturned_Click()
Forms!frmParts!frmPartsSub.Form!![DateReturned] = Now()
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top