Results 1 to 5 of 5
  1. #1
    Vethra is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    10

    Run Time Error 94

    Hi everyone,



    I'm sure this is simple for all of you guys but unfortunately I can't find a solution. Everything works great except one thing, run time error 94 "Invalid use of Null" when textbox value is deleted and the check box is still checked.

    Code:
    Private Sub Textbox1_Afterupdate()Checkbox1.Tag = Textbox1.Value
    End Sub
    Thank you,
    Dilan

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Shot in the dark, but try wrapping the textbox reference in the Nz() function.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Dead on shot, Paul...you must be using Night Vision Goggles! If the data in Textbox1 has been deleted, Dilan, the Control's Value is Null, and you cannot assign Null to a Tag Property as you're trying to do with

    Checkbox1.Tag = Textbox1.Value

    causing the Access Gnomes to complain with Error 94.

    Code:
    Private Sub Textbox1_AfterUpdate()
     Checkbox1.Tag = Nz(Me.Textbox1, "")
    End Sub

    assigns a Zero-Length String to Checkbox1.Tag if Textbox1 is empty, i.e. Null. You could replace the ZLS ("") with some other, appropriate String, if you wanted to.

    Linq ;0)>

  4. #4
    Vethra is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    10
    Thanks Pbaldy that works perfect!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  2. Replies: 3
    Last Post: 01-23-2014, 07:49 AM
  3. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  4. Replies: 0
    Last Post: 07-16-2012, 05:42 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums