[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

AddAllToList on search form

Posted on 2011-03-09
4
Medium Priority
?
516 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
[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
  • 2
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
MINDSUPERB earned 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
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 …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

650 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