#deleted

  • Thread starter Thread starter Annelie
  • Start date Start date
A

Annelie

I know I have seen this posted before, but I can't find it.
After deleting a record on a main form #deleted does not go away, even after
scrolling to other jobs. I tried requery, but that did not help.

How do I get it to go away?
Annelie
 
That did not work, but perhaps I did not use the right code. I deleted the
record with a macro calling several queries. I don't know if that makes a
difference.
My form is called FrmSales, its a main form. The main control is SalesID.
The idea is that the salesbid was accepted and now has turned into a job.
I did the requery as next line on my run macro code. Perhaps that is not
possible?
There are actually three macros that run one after the other. First the sale
is appended to Jobs, the detail is appended to jobsdetail and then the sale
is deleted from sales. Then I did me.requery so that when it is all done,
the jobs is gone from the sales. When that did not work, I tried the button,
that did not clear it.
I would really prefer that whatever the statement has to be, that it would
be run right after the macros, so when it is all done the next salesID on a
blank SalesID be shown.
Annelie
 
I'm guessing that you're not requerying the correct object. Can you post the
actions that the macro contains, along with all arguments?
 
Below is the macro which runs just fine, but my last try:
me.Frm.FormSales.requery gives an error. Then I used command button wizard
and tried me.requery and me.refresh, but deleted still shows. Probably need
to be more specific about the form.
Thanks for your help,
Annelie


Private Sub CmdMacroSales_Click()
On Error GoTo Err_CmdMacroSales_Click

Dim stDocName As String

stDocName = "MacroSalestoJob"
DoCmd.RunMacro stDocName
Me.Form.FrmSales.Requery
Exit_CmdMacroSales_Click:
Exit Sub

Err_CmdMacroSales_Click:
MsgBox Err.Description
Resume Exit_CmdMacroSales_Click

End Sub
--------------------------------
Private Sub Command187_Click()
On Error GoTo Err_Command187_Click
Me.Refresh

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_Command187_Click:
Exit Sub

Err_Command187_Click:
MsgBox Err.Description
Resume Exit_Command187_Click

End Sub
 
Some success at last. I also had problems requerying the SalesSelect
combobox on the same form. The is the combobox where I select the job, and
if it does not exist, I add a new job. But afterward I was never able to
re-select the job until after closing the form. After scrolling the
newsgroups again, I came up with this one to requery the combobox after
adding a new salesjob and it seems to work:

Private Sub SalesSelect_AfterUpdate()
Me.SalesSelect.Requery
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SalesID] = " & Str(Nz(Me![SalesSelect], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

For the delete event on the FrmSales, it must be a matter of putting the
statement into the right place.
I hope you can help me on that. It does not matter if I put it in with the
macro or do another command button.
Annelie
 
Try this:

Me.FrmSales.Requery

The above assumes that FrmSales is the name of a control on the form.
However, I believe that you want the form itself to requery, so use this
instead:

Me.Requery
 
Back
Top