Learn how to a build a cloud-first strategyRegister Now


Null Function in Visual Basic????

Posted on 2006-05-28
Medium Priority
Last Modified: 2013-11-25

I am exporting some data from a table into a fixed width file. The problem i have is that lots of the values are Null. I was getting around this by doing the following:

If IsNull(objGRNList("UNIT_QTY")) = True Then
    strGRNListQty = ""
    strGRNListQty = objGRNList("UNIT_QTY")
End If

This works, but the problem is that i've got over 20 fields to do this for. I started looking at writing a function, but VB won't let me pass a null value to a function, so i'm struggling

Any ideas please?

Question by:seancurt
1 Comment
LVL 10

Accepted Solution

fostejo earned 1000 total points
ID: 16779862

Try tagging an 'empty string onto the front on your variables, ie.

strGRNListQty="" & objGRNList("UNIT_QTY")


Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question