Skip to content
Advertisement

Data type mismatch when using a Select Query to feed a combo box

I am getting a ‘data type mismatch in criteria expression (error 3464) with the below routine when trying to activate drop down box ‘cboColleagues’.

In short, there are two combo boxes of which the second one (‘cboColleagues’) is not visible until the user activates the first (‘cboEditPersonnel’). The following routine is created to feed the second combo box with the data source however the error 3464 message appears.

    Private Sub cboEditPersonnel_AfterUpdate()

      If cboEditPersonnel = "Add Colleague" Then

        sql_get = "SELECT tblContacts.CompleteName, tblContacts.Team FROM tblContacts WHERE [tblContacts].[Team]<>'" & Form_frmStaticDataDepartments01.cboDepartments & "'"
        Me.cboColleagues.RowSource = sql_get

      cboColleagues.Visible = True

     Else

    End If

   End Sub

Advertisement

Answer

“Data type mismatch when using a Select Query to feed a combo box” usually this error is related to different type used in attribution and in comparison operator so can you tell me which one is the data type of [tblContacts].[Team] and the data type being returned from the combobox Form_frmStaticDataDepartments01.cboDepartments After looking at it I can say that you are comparing assuming it’s string (text). additionally you can add your tblContacts design and tblDepartment at for related columns beign used on your script error.

Try to check it.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement