Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246

    Unanswered: Why do I get this error

    Hi,
    I have a problem where I get an error message on exiting a form.
    The error displays as
    "Microsoft Access can't find the form 'tableB_form' referred to in a macro expression of Visual Basic code"


    I have a form (say form A) that displays details of a table (lets say table A) from this form I can go to a further form (say form B) that displays the records for table B that are filtered using form A's master record number. (Table A and Table B are related by the "master record number) On form B that displays table B filtered data, there are various user options. Depending on what the user does I get the following flow;
    1) If the the user does nothing and returns to the form A all is well.
    2) If the user updates data on form B excluding 2 particular fields and exits to the form B, no problem
    3) If the user ticks an option box and exits to the form B, they get the error message as discribed.

    The user exits form B using a button, this button calls various linked marcos which in turn run various queries. Finally the marco returns to the form A and closes the form B, it then displays the error I have mentioned. If I take out of the very last macro the closing of the form B the error does not happen.

    I've looked all through form A for code errors and also line by line taken out various macro actions and query runs, but I still get the error. I've checked each field on the form A for events and still no joy. Has anyone come across this or got a solution?



    Regards
    John

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Why do I get this error

    In which event is the last macro that is causing you the problem? It looks like the macro is called after form_B has been removed from memory, so when the macro calls form_B it is already out of scope and hence the error. Try moving the macro to a different event? Maybe that will help?
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi,
    Thanks for the reply.

    I've taken the last macro out of the equation, but all it does is close the form. When the last macro isn't there I can still see that Form B is open and I get no error, but as soon as I include the close macro or even a close form command on another macro the error re-appears. It doesn't seem to make sense to me as when there is no user input in 2 particular fields there is no error (the user can happily update other fields with no problem), but as soon as the user check these check boxes the error appears. I've even taken out 1 macro where any processing that it does when these 2 fields are checked is performed, I still get the error???

    Regards
    John

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    k, couple things:

    3) If the user ticks an option box and exits to the form B, they get the error message as discribed.
    I'm confused here.. you say that they're on form B already, what do you mean by "exits to the form B"?

    Finally the marco returns to the form A and closes the form B, it then displays the error I have mentioned.
    As already mentioned, this smacks of a reference to form B after it has been closed.

    The first step in this one is to find ALL instances that require information from form B. Find out EXACTLY what it's bombing out on. There is a call to form B when form B is closed, I am almost certain.

  5. #5
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi,
    Clarification (hopefully) below

    quote:
    --------------------------------------------------------------------------------
    3) If the user ticks an option box and exits to the form B, they get the error message as discribed.
    --------------------------------------------------------------------------------

    I'm confused here.. you say that they're on form B already, what do you mean by "exits to the form B"?


    Reply : What I mean is that the user ticks a check box and then he can exit the form by pressing a button that allows him to exit the form and go back to form A


    quote:
    --------------------------------------------------------------------------------
    Finally the marco returns to the form A and closes the form B, it then displays the error I have mentioned.
    --------------------------------------------------------------------------------

    As already mentioned, this smacks of a reference to form B after it has been closed.

    Reply : nope, this is the button command that I mentioned earlier, form B only closes after everything has been run and the user is returned to form A


    Qoute:
    The first step in this one is to find ALL instances that require information from form B. Find out EXACTLY what it's bombing out on. There is a call to form B when form B is closed, I am almost certain.

    Reply: All the calls to form B I've already elimanted from the equation because in each case I've removed references to it in all makro's and I still get the error. What I can't understand is that if there is no update of a record on Form B, no error, if I update the record but remove all macros/queries that do any processing to the underlying table of form B I still get the error. From this I deduce that there isn't a macro/query that is causing the problem. The 2 check boxes in question have no event linked to them. The only command button that calls any macros/queries is the exit button that the user has to press to leave the form and go back to form A. This command is the one that calls the various macro's/queries. But as previously stated I have taken all the record updating fuctionalitity from this command and I still get the error. Is it possible that there is code hanging around that I can not see?

    Thanks for your help

    Regards
    John

  6. #6
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    oops, soory I've found the answer, one macro was trying to close the form 3 times, didn't notice that the same command was about 50 lines down and I couldn't see it. How it got there I don't know

    Sorry to waste your time


    Regards
    John

Posting Permissions

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