As of the last office update, the IsMissing function has stopped working in my Access VBA code. Have you heard anything about this? I've 'google searched' and come up with nothing. Thanks!
Kevin, I know how to use the function and have been doing so in my database for quite a number of months. After the last office 365 update came across, the function returns false when it should (and did for said months) return true. I have changed the functions/subs I have that use it to also test for a zero value or null string - which solves the problem, but I would rather just keep clean code that can rely on proper results from a built-in function.
Kevin Yip
@Reply 2 years ago
IsMissing() only works with a variant argument that has no default value. Try the code below. If it returns true, IsMissing is working as it should:
Sub TestSub(Optional v As Variant)
Debug.Print IsMissing(v)
End Sub
I checked my old code dating back to the '97 days, and all the IsMissing functions were used with variants with no defaults.
None of the following will work with IsMissing:
Sub TestSub(Optional i As Integer)
Sub TestSub(Optional i As Integer = 1)
Sub TestSub(Optional s As String)
Sub TestSub(Optional s As String = "test")
Etc.
Kevin Yip
@Reply 2 years ago
In other words, nothing has been changed to IsMissing as far as I see.
Bretton JonesOP
@Reply
2 years ago
It was functioning for months with an optional string variable. As of the last update, not.
Kevin Yip
@Reply 2 years ago
This *2021* documentation says IsMissing only works with variants with no defaults:
"IsMissing does not work on simple data types (such as Integer or Double) because, unlike Variants, they don't have a provision for a 'missing' flag bit."
So either you misremember, or you were misled by something you saw that made you believe so.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visitor Forum.