Solved

AddAllToList on search form

Posted on 2011-03-09
4
508 Views
Last Modified: 2012-05-11
I have a search form that has text boxes and a list box. Everything works great on my search form.

I have added the AddAllToList function to add all to the listbox. All is in the listbox but I am having trouble getting my form to show all records. I put the below code into my on click event of my button but it doesnt seem to work.

 
Private Sub Btn_Search_Click()

If Me.LstAnalystName = "(ALL)" Then
Me.Frm_Search2.Form.RecordSource = "SELECT * FROM qry_AllData "

Else
   ' Update the record source
    Me.Frm_Search2.Form.RecordSource = "SELECT * FROM qry_AllData " & BuildFilter
End If
    
    ' Requery the subform
    Me.Frm_Search2.Requery

End Sub

Open in new window


I did something similar to this on another form with a combo box and it works fine. However that form is not a search form. I am having trouble with it on my search form.
 
Any help is appreciated.

Kelly
0
Comment
Question by:kmoyer9717
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 500 total points
ID: 35092316
Try to check the Column bound and the column count property of you list box.

You may try

If Me.LstAnalystName.Column(1) = "(ALL)" Then


Sincerely,
Ed
0
 

Author Closing Comment

by:kmoyer9717
ID: 35096001
This worked perfectly.

Thanks so much for your help.

Kelly
0
 

Author Comment

by:kmoyer9717
ID: 35096095
I may have spoke to soon. That worked perfectly to get the All however when I choose another analyst name to search in my list box before it returns the result i get an error "AddAllToList" "Item not found in this collection"
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 35097632
Kelly, you are welcome.

Can you post the code of your AddAllToList function?

Ed
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

777 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