?
Solved

Using a combo box to search a form.

Posted on 2017-05-16
3
Medium Priority
?
74 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 2000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

649 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