List Box help. Is it the best option?

RushG60

New member
Local time
Today, 11:34
Joined
Sep 23, 2005
Messages
6
Some background: I posted last week seeking help starting my first access project. I am trying to create a database that will allow me to enter every employee in our company along with their foreign language skills (and other skills) that they have.

Then I want to be able to create a form that will allow me to search for all the employees that have a certain skill combination (or better) that I am looking for.

Thanks to a lot of help from this form I was able to make a lot of progress.

I have three tables. One table with employee name and number, one for language/skill and language/skill number and a junction table that I want to query.

But now I am stuck on what I believe is the final step; Creating the form control that will query my junction table.

Can someone get me started on how exactly I can implement this? Is a List Box my best option?
Do I have to code it in SQL? How do I do this? Any beginner tutorials online? I couldn't find any.

I had a combo box that allowed me to search for ONE language/skill and that worked fine but I need to be able to search for employees that have combinations. Do I need a List Box for this?

Because I will in the end have about 20 languages+skills in the list I was hoping to use checkboxes on a form.
In this way I could just check next to all the skills I want, hit the control button and it would return everyone that met the requirment + anyone that exceeded the requirement. This seems better than a long list box with 20+ options.

Any ideas? I will attach my project and would appreciate help.

Thanks!
Rush
 

Attachments

I would recommend a listbox over checkboxes because a listbox can be dynamic. I wrote something that does what you want.

Code:
    Dim IntX As Integer
    Dim IntCount As Integer
    Dim SQL As String
    
    SQL = " WHERE "
    
    For IntX = 1 To List0.ListCount - 1
        If List0.Selected(IntX) = True Then
            SQL = SQL & "Language = '" & List0.Column(0, IntX) & "' OR "
            IntCount = IntCount + 1
        End If
    Next IntX
    
    If IntCount = 0 Then Exit Sub
    
    SQL = "SELECT  qryALL.EmpName, Count(qryALL.Language) AS CountOfLanguage FROM qryALL " & SQL
    SQL = Mid$(SQL, 1, Len(SQL) - 4)
    SQL = SQL & " GROUP BY  qryALL.EmpName HAVING (((Count(qryALL.Language))=" & IntCount & "));"
    
    Me.List3.RowSource = SQL

See the attachment for a working example

My method is probaly not proper, but it works

Cheers
 

Attachments

Wow, thank you very much! I will take a look at it and try to figure it out...
 

Users who are viewing this thread

Back
Top Bottom