Solved

Using a combo box to search a form.

Posted on 2017-05-16
3
47 Views
Last Modified: 2017-05-17
Hi everyone,

I have one table with a number of customer records.  One field is a phone number.  I would like to input a phone number into a combo box and have it search the form then display all the records that match the phone number in the subform.

For instance, if I type in (111) 111-1111 the subform should supply all the instances that those records occur.  I’ve included a sample database but I don’t know how to link the combo box to the table and have the records appear in the subform.

Any help would be appreciated.
Thanks.
Database1.accdb
0
Comment
Question by:birdn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 42138036
test this
--changed the row source of the combo box
--add codes to the afterupdate event of the combo box to filter the subform
db_29023186_filtering.accdb
1
 

Author Closing Comment

by:birdn
ID: 42138048
Works like a charm.  Do you mind explaining the VB cod a bit?
Thanks again for the quick response.
0
 

Expert Comment

by:Kamlesh Jain
ID: 42138636
Hello Team,

Me too Having similar issue. However, Instead of Subform, i am using Split Form.
I and trying to filter split form based on Fields, combined with text fields as well as combo box.
To be specific, i am attaching herewith screen shot of the form.

Below query results Zero Records. I am new to SQL and taken some help from here and there ...



Private Sub cmdSearch_Click()
'Show filtered  Records
Dim task As String
    task = "SELECT Val((select NZ(sum(tbllifting.[Lift_qty]),0) from tbllifting where tbllifting.[Sale_BN] = tblsale.[Sale_BN])) AS Lifted, "
    task = task + "[Sale_Qty]-Val((select NZ(sum(tbllifting.[Lift_qty]),0) from tbllifting where tbllifting.[Sale_BN] = tblsale.[Sale_BN])) AS Unlifted, "
    task = task + " * FROM tblsale WHERE"
    task = task + "[Customer] Like '*" & txtCustomer & "*' AND "
    task = task + "[Product] Like '*" & txtProduct & "*' and  "
    task = task + "[PO_No] Like '*" & txtPO & "*' AND "
    task = task + "[Storage] = ' " & cboPort.Column(0) & " '"
    task = task + "ORDER BY tblsale.Deal_Date DESC "

Me.RecordSource = task

End Sub

Guidance will be helpful.
PS : There may be some Blank records in field Storage (cboPort)
Thanks in advance.
2017-05-17.png
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question