By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

When Requering Main Form Disappearing

P: n/a
I have a main form with information on people hired and on this form I
have a button that you click to term an employee which opens a new
dialog window to enter a term date. Now it doesn't remove the
employee from the database but marks their record that they have been
termed by means of a checkbox in their record. The main form loads a
query to organize the table it pulls from. I want the order for the
form to match the query where termed employees are at the end of the
list.

So what I have written for code when you close the dialog window is:

Private Sub btnDone_Click()

Forms!frmEmployeeTable.Form.Requery

DoCmd.Close

End Sub

Now when it requeries to move the newly termed employee to the end (or
that was my hope) the main form disappears and my dialog window stays
open. I'm trying to keep main form window open but reorganize it
without having to exit the form and load it back up again.

Any help greatly appreciated.

~Narvs

Jun 13 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Wed, 13 Jun 2007 20:16:43 -0000, Narvs <Pa*********@gmail.comwrote:
>I have a main form with information on people hired and on this form I
have a button that you click to term an employee which opens a new
dialog window to enter a term date. Now it doesn't remove the
employee from the database but marks their record that they have been
termed by means of a checkbox in their record. The main form loads a
query to organize the table it pulls from. I want the order for the
form to match the query where termed employees are at the end of the
list.

So what I have written for code when you close the dialog window is:

Private Sub btnDone_Click()

Forms!frmEmployeeTable.Form.Requery

DoCmd.Close

End Sub

Now when it requeries to move the newly termed employee to the end (or
that was my hope) the main form disappears and my dialog window stays
open. I'm trying to keep main form window open but reorganize it
without having to exit the form and load it back up again.

Any help greatly appreciated.

~Narvs
DoCmd.Close if left unqualified will close the current database object, which in
your case will be frmEmployeeTable due to the previous line.

Change it to -
DoCmd.Close acForm, Me.Name

This will close the form from which the code is run.

Wayne Gillespie
Gosford NSW Australia
Jun 13 '07 #2

P: n/a
Thank you, that fixed my problem with it closing. I completely forgot
that the focus would get switched when I requeried.

~Narvs

Jun 14 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.