Close Form Button

jubb

Registered User.
Local time
Today, 17:10
Joined
Jul 27, 2005
Messages
50
I have a form that is loaded through a hyperlink from another form. On this form I have placed a command button which closes the form (DoCmd.Close) I have also used the full syntax including form name and no save prompt. When i close this form using the command button I get a request for two paramter values that are used in queries in this form (I don't want this to happen) when I click the close button on the control box "X" this doesn't happen also it doesn't happen if I use file close. This problem only occurs on some of the slower machines in my workplace, any suggestions would be greatly appreciated. The is one combo box on the form in question which is set to run a macro after update, this macro requeries the 52 list boxes on the form.
 
Can you post your code? Do all of the machines have the same version of access on them?
 
Hi the code used on the form in question is as follows:

To requery all the information displayed on the form (which is a student timetable) I use:
Private Sub Combo64_AfterUpdate()
ListM1.Requery
ListM2.Requery
ListM3.Requery
ListM4.Requery
ListM5.Requery
ListM6.Requery
ListM7.Requery
ListM8.Requery
ListM9.Requery
ListM10.Requery
ListTu1.Requery
ListTu2.Requery
ListTu3.Requery
ListTu4.Requery
ListTu5.Requery
ListTu6.Requery
ListTu7.Requery
ListTu8.Requery
ListTu9.Requery
ListTu10.Requery
ListW1.Requery
ListW2.Requery
ListW3.Requery
ListW4.Requery
ListW5.Requery
ListW6.Requery
ListW7.Requery
ListW8.Requery
ListW9.Requery
ListW10.Requery
ListTh1.Requery
ListTh2.Requery
ListTh3.Requery
ListTh4.Requery
ListTh5.Requery
ListTh6.Requery
ListTh7.Requery
ListTh8.Requery
ListTh9.Requery
ListTh10.Requery
ListTh1.Requery
ListTh2.Requery
ListTh3.Requery
ListTh4.Requery
ListTh5.Requery
ListTh6.Requery
ListTh7.Requery
ListTh8.Requery
ListTh9.Requery
ListTh10.Requery
BgName.Requery
Subjects.Requery
End Sub

To close the form I have a control button that uses the following:
Private Sub Command63_Click()
On Error GoTo Err_Command63_Click
DoCmd.Close
Exit_Command63_Click:
Exit Sub

Err_Command63_Click:
MsgBox Err.Description
Resume Exit_Command63_Click
End Sub

It is when the Command63_Click() is run I get asked to enter two of the parameters the List boxes use (Same info twice) as all the queries use the value in one combo box (students name) to limit the fields displayed.
Once again it only happens if I use Command63_Click and not if I just click the normal close ("X") button or use file close. And only on the older (slower) systems in my workplace. All machines are using access xp(2002) and access 2003. It doesn't seem to be a version problem as it occurs in both versions.
Any help appreciated.


Thanks
jubb
 
Code:
DoCmd.Close acForm, "Form Name"

Also, why requery each item individually. Why not just use
Code:
Me.Requery
 
Tried DoCmd.Close acForm, "Form Name" already didn't make a difference, ended up just using DoCmd.Close as that is what the button wizard puts in for code.

Have to requery all items individually as Me.Requery wouldn't work in this situation as the each list bix is based on a sperate query, as the information in all list boxes is stored in one table but they are different records. So I am in fact displaying 50 selected records at a time.

Thanks

Jubb
 
Last edited:

Users who are viewing this thread

Back
Top Bottom