Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 780551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:05:29+00:00 2026-05-14T20:05:29+00:00

Item in the recordset rstImportData(Flat Size) is = Null With that, given the following

  • 0

Item in the recordset rstImportData(“Flat Size”) is = Null

With that, given the following statement:

IIF(IsNull(rstImportData("Flat Size")), Null, cstr(rstImportData("Flat Size")))
Result: Throws error 94: Invalid use of Null

If I change the statement by removing the type conversion upon a false comparison:

IIF(IsNull(rstImportData("Flat Size")), Null, 0)
Result: Null

It returns Null as it should have the first time. It appears that I cannot do a type conversion in an IIF if the value passed in should ever be null even if it passes an IIF test, it still attempts to evaluate it at both the true and false answer. The only reason I’m using IIF like this is because I have a 25 line comparison to compare data from an Import against a matching record in a database to see if I need to append the prior to history.

Any thoughts? The way data is imported there will be null dates and where the spreadsheet import is in a string format I must convert either side to the other to compare the values properly but if either side is null this exception occurs 🙁

EDIT
Example of why I was using 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 for roughly 20 columns to compare in the database. I would prefer to check as part of the statement. I can think of a bunch of solutions but they involve adding much more code. If that is the case power to it, however I’m not one to give in so easily.

Options I see are

  • Creating temp vars to do the work prior to comparing and using these new vars instead of the recordset
  • Creating an object to pass the record into to preformat and work with, though extra work would provide this functionality to each import type since there are different files with similar fields

I’m here for ideas, and I’m open to any interesting pieces that can be thrown my way as I get to decide how to do it I’m looking for the most reusable approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:05:29+00:00Added an answer on May 14, 2026 at 8:05 pm

    The simple expedient of changing the value to a string helps tremendously. The trick is that trimming a string which is NULL will get a null string. Which can then be operated on as if it wasn’t a database null.
    I frequently use the form:

    CInt("0" & Trim(SomeVariant & " "))
    

    To get a valid number without having to go through a bunch of hijinks. The null is a nonentity for this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 442k
  • Answers 442k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Probably you are looking for the .svn/entries file. The format… May 15, 2026 at 5:57 pm
  • Editorial Team
    Editorial Team added an answer Attributes own association properties in UML 2. This is new… May 15, 2026 at 5:57 pm
  • Editorial Team
    Editorial Team added an answer You're looking for the SortedDictionary<TKey, TValue> class, which will automatically… May 15, 2026 at 5:57 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.