Results 1 to 9 of 9
  1. #1
    Pianopizza5 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2019
    Posts
    46

    Receiving #Type! error in Form

    Hello,



    I have a continuous form and one of the text boxes uses a formula as the Control Source. When the Allow Additions property of the form to "No," the error 2185 (can't reference a property...) is triggered anytime someone tries to search for something that is not in the record source. (This is because the unbound control loses its focus even though it has the active control.)

    To get around this, I set the Allow Additions to "Yes." The problem now is that in the "new record," the "#Type!" error appears in the field that has the formula. I tried setting a default value and using Nz so there wouldn't be any issues with null values.

    Any thoughts?


    SearchDefValueErr.accdb.zip

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,558
    I think I have already answered this in another thread?, so this is a crossposted and I am going to ignore this.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Put in error handling to trap error 2185
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    Pianopizza5 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2019
    Posts
    46
    I am so sorry! I have been searching high and low for the ideas, must’ve missed it. Do you know where the thread is?

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,558
    Search on your name.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Where did you try Nz()?

    Your procedure requires String inputs but you are passing Nulls.

    All arguments of IIf() must be able to calculate or returns error (except in SQL, where if the first argument is met the second is not evaluated).

    This works:

    =IIf(IsNull([txtSearch]),[txtFoodItem],HighTest(Nz([txtFoodItem],""),Nz([txtSearch],"")))



    View all your threads at your profile.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Pianopizza5 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2019
    Posts
    46
    Good point. I tried that in the Form - Event - On Error earlier, but this didn’t work. Do I have it in the wrong place?

    Obviously, having Allow Additions set to “No” is optimal, but I’m ok with having a blank row at the bottom.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Did you see post #6?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Pianopizza5 is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Sep 2019
    Posts
    46
    That’s beautiful. I tried this earlier, but obviously had the formula set up incorrectly. Ah, I only did the Nz on the txtFoodItem, which I see now is wrong. Everything works correctly. Thank you all very much.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 11-10-2014, 09:47 AM
  2. Receiving Error when creating Calculated Field
    By hydrojoe11 in forum Access
    Replies: 4
    Last Post: 02-04-2013, 08:01 PM
  3. Replies: 11
    Last Post: 08-27-2012, 11:26 AM
  4. Replies: 1
    Last Post: 12-02-2010, 03:04 PM
  5. Receiving error on contact database
    By tcd2004 in forum Access
    Replies: 6
    Last Post: 03-12-2010, 06:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums