Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Location
    Grand Junction, Colorado
    Posts
    12

    Unanswered: Simple IsNull Problem

    I have an existing Access 2003 FE and SQL 2005 BE that I developed but it has been a while since i had to do any mods to it and I'm rusty.

    I am getting an invalid uses of Null error.
    Any thoughts...

    Also need opinion / advice stay in 2003 or migrate to newer version, I have 2007 available on the company server but figured if I went to the trouble to upgrade I should jump to 2010...

    Thanks,
    John

    Code:
    Private Sub Form_Dirty(Cancel As Integer)
    On Error GoTo Err_Form_Dirty
    
        Dim inCostLkp As Integer
        'Dim inCurCost As Integer
          
          
         'inCurCost = Me!PtCost
        inCostLkp = Me!TtRate.Value
        
      
        If IsNull(PtCost) = True Then
        Me!PtCost = inCostLkp
        End If
          
       
        
    Exit_Form_Dirty:
        Exit Sub
    
    Err_Form_Dirty:
        MsgBox Err.Description
        Resume Exit_Form_Dirty
    End Sub

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Can Me!TtRate.Value be Null? This would explain the error.

    As far as upgrading is concerned, my advice is to skip 2007 and switch to 2010 directly.
    Have a nice day!

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by Sinndho View Post
    Can Me!TtRate.Value be Null?
    I suspect that Me!TtRate.Value being Null is, indeed, the problem. The code is in the Form_Dirty event, which means that the nanosecond the first character is entered, into any Control on the Form, it fires, assigning the value of TtRate which, at that second, is Null. And you cannot assign a Null value to a variable Dimmed as an Integer.

    My question is 'why' is this of code in the Form_Dirty event, where TtRate is almost insured to be Null? I'm guessing the OP wants to do this assignment, if the PtCost Control is empty, before the Record is saved, in which case it should be in the Form_BeforeUpdate event.

    As to the upgrade or not upgrade, if you do move up do, indeed, go to v2010, as Sinndho advised, but AC 2003 is still an strong and reliable. Given your statement about being rusty, I'd stick with 2003 until you're ready to spend a substantial amount of time learning the ins and outs of the newer versions. Going from 2003 to 2007/2010 is not a walk in the park! After spending a year or so trying out 2007, Allen Browne, one of the foremost Access authorities in the world, made the statement that learning to use 2007 (and subsequently 2010) required a learning curve that was probably 2-3 times longer for someone who had previously used Access than it was for a complete novice, because so much had been changed.

    Linq ;0)>
    Last edited by Missinglinq; 03-06-12 at 23:00.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Oct 2004
    Location
    Grand Junction, Colorado
    Posts
    12
    Thanks!

    Missinglinq
    Sinndho

    I wasn't even looking at the fact my dim was null...changed to a string and works.
    As for the form_dirty I just test in that event because it is responsive to anything I change...probably a bad habit

    In the consideration of upgrade I'm just starting a pretty significant update in function and hopefully UI. I am attracted to some of the shinny bells and whistles it looks like 2010 offers. The learning curve aside; will the tools for the UI such as styles and conditional formats give me a better looking and feeling User Interface?

    Thanks again
    John

    P.S. Here is my code for anyone looking for reference in the future...

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    On Error GoTo Err_Form_BeforeUpdate
    
        Dim inCostLkp As String
       
        inCostLkp = Me!TtRate.Value & ""
        
      
        If IsNull(PtCost) = True Then
        Me!PtCost = inCostLkp
        End If
          
          
        
    Exit_Form_BeforeUpdate:
        Exit Sub
    
    Err_Form_BeforeUpdate:
        MsgBox Err.Description
        Resume Exit_Form_BeforeUpdate
    
    End Sub

Posting Permissions

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