I would think something like the following.
Private Sub cmdResetJobList_Click()
On Error GoTo Err_cmdResetJobList_Click
Dim stDocName As String
'Save the current record so it will be included in whatever action
'you are trying to do with the open query.
If Me.Dirty = True Then Me.Dirty = False
'? the query name has an & in it. That requires you to
'surround it with brackets. If you don't your DoCmd.OpenQuery should
'be generating an error - which means that you are going to
'jump to the error handler. You have nothing in the
'error handler to tell you that you have an error.
stDocName = "[JeffCurrentJobsClearTobeAt&CrossOut]"
'? What are you attempting to do with this command?
DoCmd.OpenQuery stDocName, acNormal, acEdit
'If your query is an action query (updates,appends,or deletes records)
', you might try the following line in place of the above.
CurrentDb.QueryDefs(stDocName).Execute
Me.[jeffcurrentjobs pick from list].Requery
Exit_cmdResetJobList_Click:
Exit Sub
Err_cmdResetJobList_Click:
MsgBox Err.Description
Resume Exit_cmdResetJobList_Click
'? why is the requery in the error code? It
Me.[jeffcurrentjobs pick from list].Requery
End Sub
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Here is my code below - for some reason - it is not Refreshing the form and
even when I close and come back in - one record always Still has a check
box???
thanks,
barb
Private Sub cmdResetJobList_Click()
On Error GoTo Err_cmdResetJobList_Click
Dim stDocName As String
stDocName = "JeffCurrentJobsClearTobeAt&CrossOut"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_cmdResetJobList_Click:
Exit Sub
Err_cmdResetJobList_Click:
MsgBox Err.Description
Resume Exit_cmdResetJobList_Click
If Me.Dirty = True Then Me.Dirty = False
Me.[jeffcurrentjobs pick from list].Requery
End Sub
John Spencer said:
You need to SAVE the changes to the record before you requery.
One method would be as follows
If Me.Dirty = True Then Me.Dirty = False
Since you did not post all your code, you will have to figure out where that
line belongs in your routine.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
babs wrote:
I have A FORM THAT SHOW ALL JOBS - WE check off(yes/no) which jobs to be at.
On the form I have a command button tied to an Update query that clears all
the jobs to be at check box.
I have a line in the event procedure of the command button to
me.formname.requery
The list get all cleared(meaning not check boxes are checked) - except for
the record that I am current ON - see pencil in left side. when I close form
and come back in check box clear on current record but what code do I need to
have to have it cleared without have to come out and back into the form???
thanks,
barb
.
.