Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Close - Help

Status
Not open for further replies.

Astrith44

Programmer
Nov 23, 2002
6
0
0
US
I have a large form with a lot of code and a tab control. When the user is on tab two and uses the close button that I put at the bottom of the screen the following message box pops up - Enter Parameter Value for forms!caseDetails!BuyerMortgageCompanyID. If you enter a value nothing happens - it just closes the form.

I have checked everywhere possible for what event is initiating the query but cannot find it. If I click the close button "X" in the upper right of screen the query is not activated which is very confusing. I have tried commenting out large blocks of code and eventually am able to get rid of the problem but why does it run the query when the close button (added to the bottom of screen) is clicked but not on the form close button (upper right).

I would just scrap the form but it is huge and would take days to reconstruct. Any help troubleshooting would be appreciated. Thanks.
 
One thing about parameter boxes is they pop up if there is something the form doesn't understand. A lot of times there is a typo someplace. When the parameter box opens, pay close attention to
forms!caseDetails!BuyerMortgageCompanyID
and look for any typo there. Then check all the queries and controls associated with the Form to be sure there isn't a typo someplace in there associated with forms!caseDetails!BuyerMortgageCompanyID.
That's the first this to look for.
Good luck.

Paul
 
Hi Ast,

Your particular query is probably called from one place only.
An idea may be to trace 'back' from where this query is called to determine which event (trigger) is activating it.

I think that your events are a bit iffy, rather than code.

Regards,

Darrylle

"Never argue with an idiot, he'll bring you down to his level - then beat you with experience."
 
Astrith,

Did you ever find a solution?
I'm having the same problem with a couple of forms using unbound listboxes to provide a list of details when a row is selected in another. A parameter query pops up when a close button is sued, but not when then form control box close is used.

I've tried all sorts of things without success.

Brad
 
Brad, it would help to know what the parameter box said. Also, you might want to post the close code you have for the button.

Paul
 
Paul,

Thanks for your reply. The code behind these forms is scattered around some subs to update & requery various listbox recordsets based on a choice made in another. The general layout is:

- Have ListboxB recordset based on choice made in ListboxA.

- e.g. ListboxB Rowsource SQL including [CaseID]=Me![ListboxA] where the bound column equates to [CaseID]. Then a sub behind ListboxA that requeries ListboxB after each click.

- Using a button to close the form simply with Docmd.close. I have tried completing this statement with acform, &quot;<formname>&quot; without any improvements.

The parameter simply asks the rowsource link between the listboxes, e.g. 'Me![CaseID]' when the added close button is used, but not when then control box close button is used.

Any tips or more info needed?
Brad
 
Brad,

No, I haven't found a solution to this problem. One thing I noticed is that the problem started when I moved to Windows XP. I moved the database back to a computer that is running Windows 2000 and the problem doesn't occur. I can't explain it. I then reinstalled office XP on the computer running on WinXP and the problem still occurrs.

If you come up with something I would really appreciate a reply.

Good luck,

Joel
 
Joel,

Just want to let you know I'm still here with the same form problems. I'm working on this part time so a solution may be slow.

Interesting the XP thing. You guessed it, that's what I'm running (Office XP on Windows XP) and looks like my future network will consist of.

Brad
 
Joel, an answer! (of sorts)

Seems to be a problem with the underlying recordset (of each listbox or combobox) remaining open or asking for query parameters when the form is closed. So a workaround is to set each listbox visible property to false before closing the form. Something like:

Code:
Private Sub CloseButton_Click()
  docmd.gotocontrol &quot;<another control that remains visible>&quot;
  me![listbox1].visible = false
  me![listbox2].visible = false
  docmd.close
End sub

It might require visible properties to be set when the form is open or with other events but it works!! I have the feeling there is a better and more elegeant answer but I'm just happy I've gotten it to work.

Brad
 
Brad,

Thanks alot! I tried your idea and it worked perfectly.

I've been working on this problem on and off for months and couldn't come up with a work around. I don't care if its not elegeant. It works and I'm not spending another minute on it. You know how these things can drive you crazy and sap your productivity.

Thanks again,

Joel

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top