Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Location
    Melbourne, Australia
    Posts
    201

    Unanswered: Odd Behaviour in DoCmd.Close

    Hello. again, Colleagues All,

    I attach a small Word document which contains a screen grab of a form and the rowsource query which populates a listbox in the form. The query includes two parameters which are hidden fields in the form. This all works perfectly on my own system, but when I migrate it to my client's system, something odd happens.

    The form workds perfectly until the Close button is clicked upon. Then the program requests parameter values for each of the two fields. I have run the program with a few debug messages and the parameter fields and the listbox content retain their values right up to the end. The requests for values are triggered by the DoCmd.Close itself.

    The only relevant differences that I can see between my client's machine and my own are that I am running XP Prefessional and Access 2003 Professional, while my client is running the server version of XP and Office 2003.

    I observe that there is a lot more info on DoCmd in the Professional versions on my system (when I searched the Help index on my client's system, the only reference I received was DoCmd.GoToPage !).

    Any ideas from you incredibly smart people out there ?
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Hi Jim,

    Have you tried unhiding the FOHFactoryKey and SaladCollKey fields and seeing if they are actually populated with values?

    But I'm guessing if it happens on the docmd.close button, that something else might be needing these parameters. It's difficult without seeing it in action and if you could upload it, I'm sure I could find what's wrong fairly quickly.

    As of now though, I can only guess there are 2 fields out there somewhere which are needing a value and closing the form, something isn't happening which fills values into the fields. Sorry - this ones a tad difficult to diagnose from my end.

    I left my thinking cap at my parents house and nothing is smacking me on the face for a solution.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Oct 2004
    Location
    Melbourne, Australia
    Posts
    201
    Oooh, thats funny ! There are seven replies listed but I can only see two !

    Never mind, this is just a wrap-up on the question. as I intimated in a previous post, I did set the Rowsource to a zero-length string (I am never really happy with nulls) and the messages disappeared.

    What I suspect happens is that if the Rowsource is not explicitly stored as a property value in the object, it is flagged somehow to expect programmed values and the sequence of events was such that the Rowsource was being checked for an entry after the fields had closed down. I would love to see some of that MS source code, but I could not cope with the working environment. There is a lovely book called "I sing the body electronic" where a writer sat in with an MS team who were writing an encyclopaedia. I reached the conclusion that a large number of errors in MS software arise because the teams hoard their knowledge for professional advantage.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    I find it a tad wierd that the error goes away when using the docmd.close command and upon setting the rowsource to a zero-length. To me, that seems to indicate that there was something on the form dependant upon that rowsource (even when closing the form) and setting it to a zero-length doesn't change that there might be something still dependant upon the sql statement in that rowsource - just that it now no longer produces an error since it doesn't evaluate what fields were returned in the rowsource or the criteria. Out of curiosity, have you tried setting the rowsource to another sql (without clearing it out upon closing), perhaps a sql which is very simple (ie. returns 1 field) which doesn't have any parameters or criteria?

    For some reason, that rowsource is being evaluated when closing the form and again, these seems wierd. It almost seems like some other event is being processed (or expression) when the form is closing and my guess is that it is still happening, it just no longer produces an error since there is no criteria to evaluate. There doesn't happen to be any code in the form's OnClose event is there? (and also on any OnClose events of any subforms.)
    Last edited by pkstormy; 08-06-08 at 14:06.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Posting Permissions

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