Delete record in continuous form

D

David

Hi all, I am trying to delete a record in a continuous
form with no success. I have created a contionuous form
that is a sub-form on a main form. Wint in that continuous
formm I wanted to be able to delete a record if not
needed. I created a command button to delete the record
that it is tied to, or so I thought. Instead of deleteing
the record that the command button was on, it is deleteing
the first record. So,if I have record 1, 2 and 3 and I
don't need record 2 and click the cmd button to delete it,
Access is deleteing record 1. Any suggestions? Any help
will be appreciated.
Dave
 
J

John Vinson

Hi all, I am trying to delete a record in a continuous
form with no success. I have created a contionuous form
that is a sub-form on a main form. Wint in that continuous
formm I wanted to be able to delete a record if not
needed.

No button code is needed. Just be sure that the subform's "Record
Selectors" property is set to Yes; if it is (and if the Allow Deletes
is Yes and the form's recordsource is updateable) you can click the
grey bar at the left end of each record and click the Delete key.

You can use a command button, too - if that's easier for the users -
please post your code to see why it's not working in your case!
 
D

David Ward

Here is what I am doing. I am using a label as my button.

Thanks for your help.

Private Sub Label4_Click()
DoCmd.RunCommand acCmdDeleteRecord
End Sub
 
K

Ken Snell

Where is this label on your subform: in the subform's header? in the
subform's detail section? somewhere else?
 
D

David Ward

The label is in the subform detail right next to the data
that is being displayed.
 
K

Ken Snell

The problem likely is that your label cannot accept the focus, so ACCESS
does not know that you're clicking the label on a different record. Hence,
it deletes the record that has the focus, which in your case seems to be the
first record.

Change the label to a command button and then you should be ok.
 
D

David Ward

That was it. Thanks for your help.
-----Original Message-----
The problem likely is that your label cannot accept the focus, so ACCESS
does not know that you're clicking the label on a different record. Hence,
it deletes the record that has the focus, which in your case seems to be the
first record.

Change the label to a command button and then you should be ok.

--
Ken Snell
<MS ACCESS MVP>




.
 

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