M
mark
When placing a function into a field of query builder, I expect to be
able to apply a criteria.
For example, for the following simple function:
Function TestA(VarA) As String
If VarA > 100 Then TestA = VarA
End Function
I can insert a field in to the builder:
Expr1: TestA([RVID])
and apply the criteria <>"" to filter zero length results:
But I have a more complex function, whose return type is 'string' but
refuses to allow the criteria of <>"" to be set. It produces the 'Data
type mismatch in criteria expression' Error.
Here is the function :
Function SequenceGap(Bank As String, Number As Single, Iteration As
Long) As String
' Identifies a gap in the sequence of check numbers
Static LastNo As Single
Static LastBank As String
If LastNo = 0 Then LastNo = Number
If LastBank = "" Then LastBank = Bank
If (LastBank = Bank) And ((Number - LastNo) > Iteration) Then
SequenceGap = LastNo & " - " & Number
Else
SequenceGap = ""
End If
LastNo = Number
LastBank = Bank
End Function
insert field in to the builder:
Gap: SequenceGap([EBank Account],[Cheque],1)
CANNOT apply the criteria:
<>""
produces error: 'Data type mismatch in criteria expression'
able to apply a criteria.
For example, for the following simple function:
Function TestA(VarA) As String
If VarA > 100 Then TestA = VarA
End Function
I can insert a field in to the builder:
Expr1: TestA([RVID])
and apply the criteria <>"" to filter zero length results:
But I have a more complex function, whose return type is 'string' but
refuses to allow the criteria of <>"" to be set. It produces the 'Data
type mismatch in criteria expression' Error.
Here is the function :
Function SequenceGap(Bank As String, Number As Single, Iteration As
Long) As String
' Identifies a gap in the sequence of check numbers
Static LastNo As Single
Static LastBank As String
If LastNo = 0 Then LastNo = Number
If LastBank = "" Then LastBank = Bank
If (LastBank = Bank) And ((Number - LastNo) > Iteration) Then
SequenceGap = LastNo & " - " & Number
Else
SequenceGap = ""
End If
LastNo = Number
LastBank = Bank
End Function
insert field in to the builder:
Gap: SequenceGap([EBank Account],[Cheque],1)
CANNOT apply the criteria:
<>""
produces error: 'Data type mismatch in criteria expression'