Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expression has no value error (2002/2003)

    I have an application that is running on two Office 2003 machines. On one of these machines I am getting a 'You have entered an expression that has no value' error. This does not happen on the other machine even when the data is backed up and the same record is processed using (so I am told) the same keystrokes. The problem occours when the first line of the following code is run on the close button of a form:

    If Nz (Me.frm_SalesOrderDetails.FormOrderTotal) = " " Then
    MsgBox "Please use cancel if no products or services have been entered.", vbInformation, "Incomplete Entry"
    Exit Sub
    End If

    The Close button is on the parent of a subform / parent pair, the subform containing the OrderTotal control that is being checked in the code above. The application was written on my Office XP (Access 2002) machine. The backend is in Access 2000 format. The two front ends are running Office Pro 2003 and someone (who knows what they are doing) has been in to check the machines and upgraded both to the latest versions of Office via the Web. The problem was still there after their visit. One of the machines is running Windows XP Pro and the other (the problem machine) is running Windows XP Home. Although that is about the only difference that anybody can find between the two machines I am reluctant to conclude that XP Home is the source of their problem as I can't see why this should be and they are on a tight budget.

    Can anybody suggest somewhere else to look, or a better way of ensuring that entries have been made in the subform?

    Thanks as ever

    Ian

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

    Re: Expression has no value error (2002/2003)

    Try

    <code>If IsNull(Me.frm_SalesOrderDetails.Form.FormOrderTota l) Then</code>

    or perhaps

    <code>If Nz (Me.frm_SalesOrderDetails.Form.FormOrderTotal, "") = "" Then</code>

    Note the use of <code>""</code> instead of <code>" "</code>.

  3. #3
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression has no value error (2002/2003)

    Hans,

    If there was a space between the quotation marks in my post then that was a typing error, there is no space in the code, and it works as expected on one of the machines.
    Is there a difference between IsNull(...) and Nz(...) = ""?
    Is Nz dependant on an unusual DLL that might be missing/different on one of the machines?

    Ian

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

    Re: Expression has no value error (2002/2003)

    The IsNull function tests if the value supplied is Null, and returns True or False accordingly. The Nz function returns its first argument by default, except when that is Null, then it returns its second argument. In your original code, you didn't supply a second argument.

    The Nz function is part of Access itself, not of an "unusual DLL".

  5. #5
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression has no value error (2002/2003)

    I asked about Nz in case there was some reason for choosing it over IsNull (or vice versa) when testing for an entry in a form field. But my real problem is not the Nz function, which I have been using for some time. My real problem is identical code running on identical data working on one machine but throwing up an error on another. After checking for missing references and getting both machines up to the same Access version I am running out of potential causes. I wonder if anybody has any ideas as to where I should look next?

    Ian

    Ian

  6. #6
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression has no value error (2002/2003)

    Try looking at your Jet SP Nos.

    We had a problem with Jet SP7 when referencing a calculated control in that it returned that error in certain circumstances. Jet SP8 cured it. We suspect that there is a timing issue as to when it evaluates the expression.

    Otherwise <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  7. #7
    3 Star Lounger
    Join Date
    Sep 2002
    Location
    London, England
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression has no value error (2002/2003)

    That sounds promising. I have recalc command just before the line causing the problem to try and force the timing issue, but maybe that's not enough. Maybe DoEvents as well?

    I will visit the site soon and check their Jet versions.

    Ian

Posting Permissions

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