none
IsErr() Expression in Form Text Box RRS feed

  • Question

  • I have an Access database (inherited) that is based DBF files using the Linked Table Manager. We are going through a transition with some additional fields called F18, F19 to F23. The field names are intentionally meaningless.

    There is a DBF file for each day of the month. The file for the current day has fixed name and the files for previous days have been renamed with the date embedded in the file name. This may be significant because the way the user accesses "historical" tables is to choose a date, at which point the correct "historical" table/files is linked automatically in code. The DBF link for the current day is static.

    To accommodate the transition period, I have added text boxes to the current day and historical (past days) forms with expressions such as

    IIf(IsError([F18], Null, [F18])

    This works for the "historical" form but not for the "current day" form. It displays correct values for fields that exist and "#Name?" for fields that are missing. I just can't figure out why this works on one form but not the other.


    R Campbell



    Tuesday, November 22, 2016 4:31 AM

All replies

  • You get the "#Name?" displayed if the textbox control has the same name as the field, e.g. if the textbox control is named "F18". Rename the textbox control to to e.g. "txtF18".

    Matthias Kläy, Kläy Computing AG

    Tuesday, November 22, 2016 1:36 PM
  • Is the expression that you posted a direct copy/paste from the problematic form?  The syntax is a bit off, and as-is WILL give you the #Name result.  You need a = sign at the beginning, and you are also missing a closing parenthesis after the first F18, like this:

    =IIf(IsError([F18]),Null,[F18])


    Miriam Bizup Access MVP

    Tuesday, November 22, 2016 5:09 PM
  • Thanks for both answers. There is definitely an "=" in front of the expression and the text box name is different from the field name. I even copied the expression from the form that works and that failed as well. When I think about it, the current day form will only be in transition for one day, so I can probably live with it.

    R Campbell


    Wednesday, November 23, 2016 7:03 AM
  • Hi Dick,

    >> I even copied the expression from the form that works and that failed as well.

    Have your issue been resolved? If not, could you share us more information as below:

    1. Are the fields F18, F19 in the linked table?
    2. What data source did you set for "historical" form and the "current day" form?
    3. How did you create "historical" form and the "current day" form with F18?

    A simple project which could reproduce your issue would be much helpful or you could share us your detailed steps.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 28, 2016 8:23 AM
    Moderator
  • Hi Dick,

    >> I even copied the expression from the form that works and that failed as well.

    Have your issue been resolved? If not, could you share us more information as below:

    1. Are the fields F18, F19 in the linked table?
    2. What data source did you set for "historical" form and the "current day" form?
    3. How did you create "historical" form and the "current day" form with F18?

    A simple project which could reproduce your issue would be much helpful or you could share us your detailed steps.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    I have since configured the F18, F19 etc fields with a copy of the current day DBF containing the new fields, so that I could select them from a list (in the expression editor) rather than paste the expressions from the the other form. I thought perhaps there might be internal IDs for the fields, different on each form. It didn't seem to help. Because this is a transitional problem, that will exist for only one day for the current day form, I haven't spent any more time on it. I can have one more look tomorrow if you have any suggestions. Best regards, Dick Campbell

    R Campbell


    Monday, November 28, 2016 12:17 PM
  • Hi Dick,

    To be honesty, I could not reproduce your issue based on your current description. Could you share us a simple database which could reproduce your issue or share us detailed steps to reproduce your issue.

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 29, 2016 8:18 AM
    Moderator