Re: Invalid Use of Null Error
From: Graham Mandeno (Graham.Mandeno_at_nomail.please)
Date: 06/17/04
- Next message: fredg: "Re: Picking up criteria from form box"
- Previous message: Terry: "Re: Invalid Use of Null Error"
- In reply to: Josef: "Invalid Use of Null Error"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Jun 2004 10:56:57 +1200
Hi Josef
You have two options:
1. Make your variables of type Variant. A Variant is the only data type
that can hold a Null value. Only do this if you want to distinguish between
Nulls and empty strings, because Variants are less efficient to process.
2. Use the Nz function to convert Nulls to empty strings:
stGender = Nz ( rst ( "Gender" ), "" )
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
"Josef" <jvelardi@hotmail.com> wrote in message
news:MPG.1b3cc1469c9e0b5498969c@news.microsoft.com...
>
> hi,
>
> i am trying to get data from a record set. some fields are null and when
> i try to use this data i get an 'Invalid Use of Null' Error.
>
> ----- Code Snippet -----
>
> Set dbs = CurrentDb()
> strSQL = "SELECT * FROM tbl_STUDENT;"
> Set rst = dbs.OpenRecordSet(strSQL)
>
> While (Not rst.EOF)
>
> stSudentID = rst("Student ID")
> stFName = rst("First Name")
> stMName = rst("Middle Name")
> stLName = rst("Family Name")
> stGender = rst("Gender")
> stDOB = rst("DOB")
>
> ....
>
> rst.MoveNext
>
> WEnd
>
> ----------------------
>
> any suggestions on how i can test for Null, or use a different routine
> to get the data from the record set.
>
> many thx.
>
- Next message: fredg: "Re: Picking up criteria from form box"
- Previous message: Terry: "Re: Invalid Use of Null Error"
- In reply to: Josef: "Invalid Use of Null Error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|