?
Solved

Using a combo box to search a form.

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

850 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