Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    You are entering an expression that has no Value.

    I have an unbound text box on a form that I use it to capture the value from a subform for use in an ADO update routine. This is the expression:-

    =[subfrm_CarAvailable].[Form]![txt_LogginID]

    I am testing to see what happens when no data is selected in the subform and the command button is pressed.


    It works OK with data.

    But when I tested it with no data, it threw up an error:-

    ----------------------------------------------
    ----------------------------------------------
    Microsoft Visual basic

    Run-time error

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: You are entering an expression that has no Value.

    Does Form_frm_View.txt_GotCarRef refer to a control on the subform or what? I thought your subform was subfrm_CarAvailable. What exactly are you trying to do here? If you want to see if there are any records for that car in the subform, then the empty string will fail because there are no records for it to compare. What you can do in that case is test the subform's NewRecord property to see if that's where the cursor was when you exited the subform. Alternatively, you can use the subform's recordsetclone's recordcount property to determine if there are any records.
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: You are entering an expression that has no Value.

    Oh dear!

    Not very clear is it!

    I

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: You are entering an expression that has no Value.

    Is the textbox by any chance hidden? If so, you might temporarily make it visible to see what's going on. What I expect is happening is that since there is no record on the subform, your textbox can't refer to a control that isn't there. Bound controls aren't null when there is no record, they effectively aren't there. So I'd recommend you use code to test the recordcount of the subform's recordsetclone. That will tell you if there are any records.
    Charlotte

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: You are entering an expression that has no Value.

    <hr>Could it have gone astray?<hr>
    Don't know, but there have been some questions about this lately. I haven't seen it myself, though.
    <hr>which is the safest way, or best way, On Error, or checking the recordcount
    of the subform's recordsetclone?<hr>
    I'm not sure what the difference is between On Error and an error handler, unless you're referring to the OnError event.

    In that case, I have to ask, "which one?" Are you talking about the OnError event of the parent form? if so, I wouldn't rely on it. An error handler would be more reliable, but it might be easier to check for the clone's recordcount than to figure out all the possible errors you might have to trap in an error handler.
    Charlotte

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: You are entering an expression that has no Value.

    Dear Charlotte,

    Thanks again for you observations.

    You are correct, the text box is hidden, and when I unhide it I can see that it has the value #error. That got me thinking and I think I

Posting Permissions

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