[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 520
  • Last Modified:

AddAllToList on search form

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
kmoyer9717
Asked:
kmoyer9717
  • 2
  • 2
1 Solution
 
MINDSUPERBCommented:
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
 
kmoyer9717Author Commented:
This worked perfectly.

Thanks so much for your help.

Kelly
0
 
kmoyer9717Author Commented:
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
 
MINDSUPERBCommented:
Kelly, you are welcome.

Can you post the code of your AddAllToList function?

Ed
0

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now