Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    79

    Unanswered: Null Value when not a null value

    I have the following code and it continues to state a null value when it reaches tempUniqueID = rst![unique id]. However, the table is populated. Any help that can be given is greatly appreciated.

    Here is my code:

    Private Sub cmdFillBlanks_Click()
    Dim db As DAO.Database
    Dim rst As DAO.Recordset
    Set db = CurrentDb
    Dim tempUniqueID As String
    Set rst = db.OpenRecordset("GSM blank spaces2")
    rst.MoveFirst
    tempUniqueID = rst![unique id]

    Do Until rst.EOF
    If IsNull(rst![unique id]) Then
    rst.Edit
    rst![unique id] = tempUniqueID
    rst.Update
    Else
    tempUniqueID = rst![unique id]
    End If
    rst.MoveNext
    Loop
    rst.Close

    End Sub

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Can you run this and report back?
    Code:
    SELECT *
    FROM [GSM blank spaces2]
    WHERE [unique id] IS NULL
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Nov 2005
    Posts
    79

    771 Blank Records

    I get 771 blank records.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Those aren't "blanks" - they are called nulls.

    I've reread your code. Actually, this is what I should have asked for:
    Code:
    SELECT TOP 1 *
    FROM [GSM blank spaces2]
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by pootle flump View Post
    Those aren't "blanks" - they are called nulls.

    I've reread your code. Actually, this is what I should have asked for:
    Code:
    SELECT TOP 1 *
    FROM [GSM blank spaces2]
    Unless they are, in fact, blanks (zero length strings). Which would explain why testing for null yields false...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Notice the line that errors - he attempts to assign the value before checking for nulls. This only occurs on the first row. So I think the "first" row in the table has a null for [unique id].
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •