Thread: Search for subform record
07-16-10, 19:47 #1Registered User
- Join Date
- Apr 2010
Unanswered: Search for subform record
I've made a ton of progress on my database thanks to all of the help from this forum! I seem to have run into another brick wall and so I thought I'd throw my question out there to see if anyone can help.
I'm working with four forms altogether:
-frmMain (splash form where searching is done)
-frmCustomers (main form containing two subforms)
-frmInvoices (subform containing invoice pricing info)
-frmInvoiceDetails (subform containing equipment in invoice)
I want to use the main form to search by InvoiceID (key field) in frmInvoices subform to bring up a single invoice with all of its related information from frmCustomers main form and frmInvoiceDetails subform.
I have no idea how to go about this and would really, really appreciate any help. Thanks!
07-17-10, 08:24 #2Moderator
- Join Date
- Dec 2004
- Madison, WI
It would be easier to put the InvoiceID search box on the frmInvoices versus the frmInvoiceDetails. Then you could add code as such in the afterupdate event of the InvoiceID combo search box (ie. MySearchCombobox in the example below):
Dim InvID as variant
InvID = Me.MySearchCombobox.value
(Note: The field InvoiceID must be visible/enabled on the subform itself. This field can be locked.)
Note also: you may then need to set the sourceobject of frmInvoices to something like:
Forms!frmInvoices.SourceObject = "Select * from myInvoiceTable where InvoiceID = " & InvID & ""
Last edited by pkstormy; 07-17-10 at 08:33.Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)