Results 1 to 4 of 4
  1. #1
    mholland999 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    6

    Question Form/Subform Solution Guru needed!!!

    I could really use some help here. I have looked online for a solution and can't find anything close to my problem.



    I have a form (New_Hire_detail) with a sub form (New_Hire_File_Attachments). When I open the form "New_Hire_Detail" I perform some actions such as enabling and disabling fields based on the current user's role in table "Lkup_Users". Then I inspect several fields to see if they are complete and set their background color to a shade of red if they are incomplete. The enabling/disabling fields is in one function and the field checking is in another.

    If i am opening a specific record, everything works, no errors and the application performs as expected.

    EXCEPT when I open the form in "Add" mode to create a new record. Then I get the error: "-2147352567 You've entered an expression that has no value". I am stumped on how to trap for the error. I think I have tried all the various event properties and still can't keep this error from appearing. How can I stop this error from appearing but get other errors I have created traps for?

    My assumption is that the issue is caused from the subform "New_Hire_File_Attachments" has no related record yet in form "New_Hire_detail". When I enable or disable the field, I think this is when I get the error.

    Any ideas on how to trap for the error or suppress it?

    I can post code but not sure where to begin I have a lot of code.

    Desperate for a solution!

    -M

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Here are the basics of error trapping:

    http://www.baldyweb.com/ErrorTrap.htm

    It would help to know what line of code throws the error. Offhand you might want to avoid the error rather than trap it. I'm thinking testing:

    Me.NewRecord

    and only performing your process on existing records. Also, Conditional Formatting is typically simpler than code-based solutions.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    mholland999 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    6
    pbaldy, I like how you use the select case for error management, I think I will adopt that. but I am not sure how to find where that error occurs, any ideas? Is it the onload event of the main form or the onload of the sub form? or other?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    You tell me; unless you have error trapping already, you should be given the option to Debug, which will take you to the offending line. If you have error trapping already, temporarily comment out the "On Error" lines.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 03-10-2012, 07:34 AM
  2. Replies: 3
    Last Post: 09-16-2011, 10:09 AM
  3. Replies: 3
    Last Post: 07-01-2011, 12:06 PM
  4. Replies: 2
    Last Post: 02-09-2011, 05:19 PM
  5. Access 2007 Code Guru please: Unbound Attachment
    By MatthewFF in forum Programming
    Replies: 2
    Last Post: 02-01-2010, 07:31 AM

Tags for this Thread

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