Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP ME USE OF FUCTION NZ

Status
Not open for further replies.

lizz3030

Technical User
Feb 12, 2004
8
MX
Hi everybody:

I need code by it transforms the null values into empty chains or zeros with the "function Nz", because got out mistake in my program as " the field can not be a chains of longitud zero in TextBox; Or well some any other suggestion.

Thanks a lot by their attention.

 
There is no function Nz in Visual Basic. It must have been written by the person who wrote the original code.

All it would do is something like this:
Code:
Public Function Nz(adoField As Field) As String
  If adoField.IsNull Then
    Nz = ""
  Else
    Nz = adoField.Value
  End If
End Function
You would write similar functions for bit-fields, dates, integers & longs. I've left this for you to do.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
NZ is a Microsoft JET function. You can use it from VB within an SQL statement that you are submitting to JET but, as chiph says, it's not a function that's available to native VB. You can achieve a similar effect with an immediate IIF as in
Code:
   myVar = IIF ( IsNull(SomeVar), 0, SomeVar )
OR
Code:
   myStr = IIF ( IsNull(SomeStr), "", SomeStr )
 
Hello All . . . . .

If one checks the object library, one will find NZ to be a member of Microsoft Access 9.0 Object Library. Specifically "MSACC9.olb".

As such . . . . you can use it just about anywhere VBA is allowed. Have used it quite a bit myself.

TheAceMan [wiggle]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top