Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Location
    USA
    Posts
    6

    Question Unanswered: IsNull on a TextBox control

    Platform: MS Access 2000 - Win 2K Adv Svr - SQL Svr 2K SP3a

    I have a form that has many controls (> 70) and code that up until yesterday, worked just fine.

    The code snippet follows:

    If Not IsNull(Me.PredictedTime) Then
    GetPredictedTime = Format(Me.PredictedTime.Value, str_format)
    Else
    GetPredictedTime = ""
    End If

    The GetPredictedTime function call is failing, claiming the control has a
    field, control or property name that the application can't find.
    (PredictedTime is a valid TextBox - I'm getting very tired of looking at the parent form!)

    I have done some debugging using IsObject and IsEmpty which returns
    what you might expect from a valid object. (IsObject true, IsEmpty false)

    This code works correctly in the same project using MS Access tables, the code above is using Access 2000 with the data in SQL Server using link tables via ODBC. (DAO for data-access)

    The code had previously been working (at least it got past this function call) but now it has decided to break, no clear understanding as to why...

    Anyone have clues, suggestions, suicide rituals?

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Have you tried a different comparison?

    Me.PredictedTime & "" <> ""

    I use this to eliminate the empty string problem with VBA ... An empty string is not the same as a null string ...

  3. #3
    Join Date
    Oct 2003
    Location
    USA
    Posts
    6

    Re: IsNull on a TextBox control

    Thanks for the suggestion, same result.

    Run-Time error '2424':

    The expression you entered has a field, control or property name that
    (insert appname here) can't find.

    So it's a valid control, IsNull(Me.Control) returns false. This implies I should be able to reference it's value. But I cannot, I changed the default value of the control to "Null" and still received the same results.

    Something within the VBA project is toast, I'll have to rebuild the database and it's links. Commenting out the offending statement just makes the same problem appear lower in the code. Did I mention this was functioning code just a few days ago?

    Thanks Microsoft!

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Yep. Time to do a compact & repair ... Then try running the form and put a break point in and try and find the offending method ... You also might try compiling the project ... Any invalid references/methods will pop up.

  5. #5
    Join Date
    Oct 2003
    Location
    USA
    Posts
    6

    Re: IsNull on a TextBox control

    Originally posted by M Owen
    Yep. Time to do a compact & repair ... Then try running the form and put a break point in and try and find the offending method ... You also might try compiling the project ... Any invalid references/methods will pop up.
    I opted for the much more difficult approach. Creating a new MDB and importing all forms, reports, modules, macros, etc. Linking all 100+ ODBC tables was a pain.

    This worked and all is well again. Note that a recent attempt to Compact and Repair ended with the same result as my previous attempts. When I comment out the offending line, the next control reference becomes the "new" problem.

    Thanks for the suggestions!

Posting Permissions

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