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

flc13090

New member
Local time
Today, 08:47
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: 138

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:47
Joined
May 7, 2009
Messages
19,169
declare startdate as Variant also then change this to:

If IsNull(startdate) Or IsNull(validate) Then
 

flc13090

New member
Local time
Today, 08:47
Joined
May 20, 2022
Messages
2
Thanks arnelgp, the problem is solved.
 

Users who are viewing this thread

Top Bottom