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

How to filter a subform based on a combo box selection

Status
Not open for further replies.

src2

Technical User
Mar 1, 2001
72
US
First of all my apologies for being so dense. I've been spinning my wheels trying to get this to work for sometime and looking at previous posts and examples just isn't getting it to work for me. For example I tried method 3 in a link to four ways to move a record from a cobo box selection on microsfts support site. After trying the example 3 times with errors I gave up.

Here is what I'm trying to do. I want to use an unbound form called Sales. On that form place a combobox to list customers by name. I want to select a customer and have the customer information appear in a subform.

Can someone please give me some help. Thanks a lot.
 
Use your VBA code in the form "Sales" in the event for Private Sub cboCustomers_Change(). Use cboCustomers.Value to update the subforms recordset.

This should help you get started. Let me know if you need further help.


-Pete
 
I'm afraid I need more detailed instructions. Here's what I have.

Form - Sales, RecordSource is blank
control - cboCustomer, RecordSource is blank, rowsource is
Customers (Table)

Subform - sfrmCustomerInformation,
recordsource = qryCustomerInformation

Query - qryCustomerInformation
Criteria [forms]![Sales].[cboCustomer]

 
hmmm...im not positive I understand exactly how you have it set up.....but try this:

In the Sales form go to your vba and paste the following code:
Code:
Private Sub cboCustomer_Change()
     Form_sfrmCustomerInformation.Requery
End Sub

-Pete
 
I tried it and it didn't work. I frequently get the error msg, "error accessing file, network connection may have been lost."
I have the database stored on a flashdrive and I'm not using any network resources that I know of. I have checked however to see if I'm still connected to the network and I am. Any more thoughts? If you need more information to understand what I have I'll try and supply it. Thanks for helping!
 
I'm sorry. I've never experienced that error. Sorry that I'm no further help.


-Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top