Solved Access2013Pro - Custom function return #Error in a QBE query (1 Viewer)

flc13090

New member
Local time
Today, 23:52
Joined
May 20, 2022
Messages
2
Hello everyone,
I have created a custom function to test fields in a table via a QBE query.
But this function returns me #error if the validate field is empty or null
What should I do please?
Thanks
Code:
Public Function myFunction(startdate As Date, _
                        validate As Variant, _
                        strfld1 As Boolean, _
                        strfld2 As Boolean, _
                        strfld3 As Boolean, _
                        strfld4 As Boolean, _
                        strfld5 As Boolean) As Long
Dim result$

If Not IsNull(startdate) And IsNull(validate) Then
    result$ = 1
ElseIf conditions Then
    statment
ElseIf conditions Then
    statment
ElseIf conditions Then
    statment
ElseIf conditions Then
    statment
...
ElseIf conditions Then
    statment
ElseIf conditions Then
    statment
Else
    result$ = 0
End If
myFunction = result$
End Function
 

Attachments

  • 20220520_1.jpg
    20220520_1.jpg
    48.9 KB · Views: 42

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 06:52
Joined
May 7, 2009
Messages
16,419
declare startdate as Variant also then change this to:

If IsNull(startdate) Or IsNull(validate) Then
 

Users who are viewing this thread

Top Bottom