Combobox brain teaser (1 Viewer)

rdw456

Novice
Local time
Yesterday, 19:09
Joined
Jul 20, 2012
Messages
43
Hi all merry Christmas to you all

I have a combobox on a main form called Employee it uses a table called

tblEmployee
Employee_ID auto number
First name Text
Last name Text
Phone number Text
Inactive yes/no

On the form when you select a name it places in the field Emplee_ID on the main table all works well until we had staff turnover. I then changed the combo box query criteria to filter just the active staff which worked fine until I went back to previous records of the person who had left and found the field blank when I take the filter off they are there. The other strange thing is in the main table the employee_ID field which is of the number type has been accepting text and because it has a lot of record and it won't let me. The main table also has a auto number field Trans_ID that is used as a primary key. I have tried many things in the properties of the combobox but dont seem to be able to arrive a solution.

Any idea's would be welome

Thanks Bob Wild
 

Gasman

Enthusiastic Amateur
Local time
Today, 03:09
Joined
Sep 21, 2011
Messages
14,231
I haven't looked at Colin's link, but I got around this by the following

Code:
Private Sub Form_Current()
Dim strCWSource As String, strActive As String, strOrder As String
strCWSource = "SELECT Lookups.ID, Lookups.Data From Lookups"
strCWSource = strCWSource & " WHERE ((Lookups.DataType) = 'Email')"
strActive = " And ((Lookups.DataActive) = True)"
strOrder = " ORDER BY Lookups.Data"

Me.CaseWorker.RowSource = strCWSource

If Me.NewRecord Then
    Me.CaseWorker.RowSource = strCWSource & strActive
    Me.TransactionDate.SetFocus
End If
Me.CaseWorker.RowSource = Me.CaseWorker.RowSource & strOrder
'Debug.Print Me.CaseWorker.RowSource

End Sub

HTH
 
Last edited:

Users who are viewing this thread

Top Bottom