requery subform- and delete question

J

Junior

using a subform to delete entries from a table -
the parent form also uses a query of this same table to populate a cbobox

whenever i delete a record from the table - using the subform - where should
i use requery so that the cbo on the main form will not include the record
that was just deleted??
Second question - using the record selector in the subform to delete - but
it doesn't popup a warning message - any ideas why?
 
K

Ken Snell [MVP]

First question:
You could use the form's AfterDelConfirm event to test that the delete
was performed, and then do the requery of the main form's combo box's
RowSource query.

Private Sub Form_AfterDelConfirm(Status As Integer)
Select Case Status
Case acDeleteOK
Me.Parent.cboName.Requery
Case acDeleteCancel, acDeleteUserCancel
' do nothing
End Select
End Sub



Second question:
Check the following items:
-- the "Confirm" options in Tools | Options | Edit/Find tab have not
been deselected.
-- there is no code in the form's BeforeDelConfirm event procedure that
tells ACCESS to not ask for confirmation (this usually would be a single
code step that sets the Response variable to acDataErrContinue without a
preceding message box to the user).
-- somewhere, your code has turned off the SetWarnings property and
didn't turn it back on.
 
J

Junior

thanks
Ken Snell said:
First question:
You could use the form's AfterDelConfirm event to test that the delete
was performed, and then do the requery of the main form's combo box's
RowSource query.

Private Sub Form_AfterDelConfirm(Status As Integer)
Select Case Status
Case acDeleteOK
Me.Parent.cboName.Requery
Case acDeleteCancel, acDeleteUserCancel
' do nothing
End Select
End Sub



Second question:
Check the following items:
-- the "Confirm" options in Tools | Options | Edit/Find tab have not
been deselected.
-- there is no code in the form's BeforeDelConfirm event procedure that
tells ACCESS to not ask for confirmation (this usually would be a single
code step that sets the Response variable to acDataErrContinue without a
preceding message box to the user).
-- somewhere, your code has turned off the SetWarnings property and
didn't turn it back on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top