I was wondering if someone could give me a little guidance on how best to compare strings, other data types and test for nulls or empty strings.
I am using the .tag property of controls to store "pre-edited" data and then checking for any changes upon exit/submit/save and inserting the edits into the table. For some reason I have yet to absorb a rule of thumb for the comparing and I thought someone might be able to direct me.
For example, in the case that a field is not required, it may be blank. How best should I trap for null values or empty strings? Nz(fieldname, "") compared to Nz(fieldsname.tag, "")?
When it comes to ANY field I'm comparing I simply write:
Is there a better way to compare strings and other data types (longs, integers, boolean) that is better, or is this OK?
Thanks, I appreciate the help!
I am using the .tag property of controls to store "pre-edited" data and then checking for any changes upon exit/submit/save and inserting the edits into the table. For some reason I have yet to absorb a rule of thumb for the comparing and I thought someone might be able to direct me.
For example, in the case that a field is not required, it may be blank. How best should I trap for null values or empty strings? Nz(fieldname, "") compared to Nz(fieldsname.tag, "")?
When it comes to ANY field I'm comparing I simply write:
Code:
If fieldname <> fieldname.tag then
'insert the edit into the proper table
End If
Thanks, I appreciate the help!