I've been changing my DAO to ADO and I have a problem with my Criteria. When I use only 1 criteria to find records in a recordset there is no problem, but when I use 2 or more citeria I've always error 3001 : Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
Does somebody know what I'm doing wrong here.
Below is my function that I have written:
Public Function Check_Permission(TabelNr As Integer) As Integer
On Error GoTo Err_Check_Permission
Const conTableName as String = "Tbl_BevoegdheidFormulier"
Dim strPermCriteria As String
Dim rstPermRecord As New ADODB.Recordset
Set rstPermRecord = New ADODB.Recordset
strPermCriteria = "[TabelId] = " & TabelNr & " And [PersoneelsId] = " & intUserId
rstPermRecord.Open conTableName, CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
rstPermRecord.Find strPermCriteria
If rstPermRecord.EOF Then
Select Case TabelNr
Case 11
strPermCriteria = "[TabelId] = " & TabelNr & " [GroepId] = " & bytGroep
Case 14
strPermCriteria = "[TabelId] = " & TabelNr & " And [GroepId] = " & bytGroep
End Select
rstPermRecord.Find (strPermCriteria)
If rstPermRecord.EOF Then
Check_Permission = 1
Else
Check_Permission = rstPermRecord!BevoegdheidId
End If
Else
Check_Permission = rstPermRecord!BevoegdheidId
End If
rstPermRecord.Close
Exit Function
Err_Check_Permission:
Call Display_Message(Err.Number & vbCrLf & Err.Description)
End Function
Live fast, die young and leave a beautiful corpse behind.
Does somebody know what I'm doing wrong here.
Below is my function that I have written:
Public Function Check_Permission(TabelNr As Integer) As Integer
On Error GoTo Err_Check_Permission
Const conTableName as String = "Tbl_BevoegdheidFormulier"
Dim strPermCriteria As String
Dim rstPermRecord As New ADODB.Recordset
Set rstPermRecord = New ADODB.Recordset
strPermCriteria = "[TabelId] = " & TabelNr & " And [PersoneelsId] = " & intUserId
rstPermRecord.Open conTableName, CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
rstPermRecord.Find strPermCriteria
If rstPermRecord.EOF Then
Select Case TabelNr
Case 11
strPermCriteria = "[TabelId] = " & TabelNr & " [GroepId] = " & bytGroep
Case 14
strPermCriteria = "[TabelId] = " & TabelNr & " And [GroepId] = " & bytGroep
End Select
rstPermRecord.Find (strPermCriteria)
If rstPermRecord.EOF Then
Check_Permission = 1
Else
Check_Permission = rstPermRecord!BevoegdheidId
End If
Else
Check_Permission = rstPermRecord!BevoegdheidId
End If
rstPermRecord.Close
Exit Function
Err_Check_Permission:
Call Display_Message(Err.Number & vbCrLf & Err.Description)
End Function
Live fast, die young and leave a beautiful corpse behind.