How do you refer to a null field in a UDF

J

JohnC

Ok trying to create a user defined function to use in a query
It assesses two fields -one is a currency field the other is a -
text field
Some times the text field blank
So if the currency fields is less than 100 and the text field is null
I want it to put the word “Priority “ in the query field


Public Function ABC(f1 As Currency, f2 As String)
If f1 < 100 And IsNull(f2) Then
ABC = "Priority"
End If

Rest of the code works ok the isnull(f2) is obviously wrong
 
D

Douglas J. Steele

The only data type that can accept a Null value is the Variant.

If the Currency field will always have a value, try

Public Function ABC(f1 As Currency, f2 As Variant)

If there's also a chance that the Currency field will be Null, use

Public Function ABC(f1 As Variant, f2 As Variant)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)



Ok trying to create a user defined function to use in a query
It assesses two fields -one is a currency field the other is a -
text field
Some times the text field blank
So if the currency fields is less than 100 and the text field is null
I want it to put the word “Priority “ in the query field


Public Function ABC(f1 As Currency, f2 As String)
If f1 < 100 And IsNull(f2) Then
ABC = "Priority"
End If

Rest of the code works ok the isnull(f2) is obviously wrong
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top