I previously had a problem solved here using a Dcount. Previously I checked how many trainings there were when the TRNG_ID = (combobox value) and EMP_ID = (Combobox value). This worked out fine and I was able to check for duplicates using this method. I have now run into a problem however where it seems to be more beneficial to count how many different TRNG_IDs I have that have when TRAINING = (combobox value) and EMP_ID = (Combobox value). Here is the code I tried using to accomplish this.
Dim count As Integer
Dim lookup As Integer
Dim emp As Integer
emp = Me.TXT_EMP.Column(2)
Dim trng As Integer
trng = Me.TXT_TR.Column(1)
count = DCount("[TRNG_ID]", "[EMP_TRNG_TBL]", "[TRAINING] ='" & trng & "'" And "[EMP_ID] = " & emp)
This code is giving me a data type mismatch error and I am not sure where this is occurring. If you could enlighten me on what I am missing, that would be greatly appreciated. Thank you for your time.