Results 1 to 6 of 6

Thread: [RESOLVED] Invalid use of Null

  1. #1

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Resolved [RESOLVED] Invalid use of Null

    I am adding some dates to an array of variant Date type and I get the above error and I thought this was correct.
    I searched here (post #2) and found the answer to be the same as I am doing:
    Code:
    For i = 0 To 13
        If chkHistory(i).Value = vbChecked Then
            GradeHistoryDates(i) = dtpHistory(i).Value
        Else
            GradeHistoryDates(i) = Null
        End If
    Next i
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Invalid use of Null

    Try:
    Set GradeHistoryDates(1) = Null
    Tengo mas preguntas que contestas

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Invalid use of Null

    How did you declare the GradeHistoryDates array? It must be declared as

    Dim GradeHistoryDates(13) As Variant

  4. #4

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Invalid use of Null

    Haven't had a chance to get back to this yet ;-)

    I have declared it as:

    Public GradeHistoryDates(13) As Date

    Why can't you do this then
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Invalid use of Null

    In VB, Variant is the only data type that can be Null.

  6. #6

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: Invalid use of Null

    So is Null the best way to handle empty dates?
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

Posting Permissions

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



Click Here to Expand Forum to Full Width