Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Oct 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is Null (Access 2000)

    How can i set all the empty dates in the field to the present date? My field is called Enlistingdate, a part of the table Students and some of the entries are not filled in. Therefore i want
    all the empty fields to be filled in with the present day.
    My efforts were on the line of setting the Where to Null:
    Dim StrStudents As String
    StrStudents = "UPDATE students Set EnlistingDay = Date () Where EnlistingDate Is Null
    db.Execute STrStudents
    Why is it wrong?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Is Null (Access 2000)

    The SQL looks OK. What goes wrong?
    - You get an error message - if so, what does it say?
    or
    - The code runs without error, but nothing happens?

  3. #3
    New Lounger
    Join Date
    Oct 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is Null (Access 2000)

    i get the error 91 : object variable or with block variable not set

    regards

    Shokarov

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Is Null (Access 2000)

    Either replace db with CurrentDb, or use the following:

    Dim db As DAO.Database
    Dim strStudents As String
    Set db = CurrentDb
    strStudents = "UPDATE ..." ' your SQL string
    db.Execute strStudents

    Note: since this code uses DAO, you must have a reference to the Microsoft DAO 3.6 Object Library in Tools | References...

  5. #5
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Is Null (Access 2000)

    Access doesn't know what "db" is, you didn't define it. Use Currentdb.execute instead.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  6. #6
    New Lounger
    Join Date
    Oct 2005
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Is Null (Access 2000)

    Thank you !!!

Posting Permissions

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