Solved

AddAllToList on search form

Posted on 2011-03-09
4
509 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

My experience with Windows 10 over a one year period and suggestions for smooth operation
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

809 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