Item in Recordset rstImportData (Flat Size) = Null
Moreover, given the following statement:
IIF(IsNull(rstImportData("Flat Size")), Null, cstr(rstImportData("Flat Size")))
Result: Throws error 94: Invalid use of Null
If I changed the instruction by deleting the type conversion in a false comparison:
IIF(IsNull(rstImportData("Flat Size")), Null, 0)
Result: Null
It returns Null as it should have the first time. It seems that I cannot convert the type to IIF, if the passed value should be zero, even if it passes the IIF test, it still tries to evaluate it both with a true and a false answer. The only reason I use IIF is because I have a 25-line comparison to compare the data from Import with the corresponding record in the database, to see if I need to add before the story.
Any thoughts? The way the data is imported will have zero dates and where the spreadsheet import is in row format. I have to convert both sides to the other in order to compare the values โโcorrectly, but if each side is null, this exception occurs: (
EDIT An example of why I used IIF (and considering using a universal function)
If master("one") <> import("one") Or _
master("two") <> import("two") Or _
master("date") <> import("date") Or _ //import("date") comes from a spreadsheet, it comes in as string, CAN be a null value
master("qty") <> import("qty") Or _ //import("qty") comes from spreadsheet, comes in as a string can CAN be null
master("etc") <> import("etc") Then
....stuff....
End If
This code expands by approximately 20 columns for comparison in the database. I would rather check as part of the statement. I can come up with a set of solutions, but they include adding a lot more code. If so, then it is not so easy.
The options that I see are
- Creating temp vars to do the work before comparing and using these new vars instead of a set of records
- preformat , ,
, , , , . .