PC Review


Reply
Thread Tools Rate Thread

delete records

 
 
=?Utf-8?B?UHJpbWVwaXhpZQ==?=
Guest
Posts: n/a
 
      23rd Mar 2006
I am having problems with this code:
Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click
Dim strWhere As String

strWhere = MsgBox("Do you want to delete this record?", vbYesNo)

If strWhere = vbYes Then

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Else
Exit Sub
End If

Exit_cmdDelete_Click:
Exit Sub

Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click

End Sub

What it is doing is every time I click the command button on the form where
I enter and delete the records it moves other fields around and move some
records to others and keeps moving the records around. Do I need to change
something to get it to delete the complete row and not move the fields
around.

I am confused on this one.
Thanks,
Pixie


 
Reply With Quote
 
 
 
 
=?Utf-8?B?QW5kcmV3IFRhcHA=?=
Guest
Posts: n/a
 
      23rd Mar 2006
In Access 2000 i would use the line
DoCmd.RunCommand acCmdDeleteRecord

This command deletes the current record.

Hope this helps.

"Primepixie" wrote:

> I am having problems with this code:
> Private Sub cmdDelete_Click()
> On Error GoTo Err_cmdDelete_Click
> Dim strWhere As String
>
> strWhere = MsgBox("Do you want to delete this record?", vbYesNo)
>
> If strWhere = vbYes Then
>
> DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
> DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
> Else
> Exit Sub
> End If
>
> Exit_cmdDelete_Click:
> Exit Sub
>
> Err_cmdDelete_Click:
> MsgBox Err.Description
> Resume Exit_cmdDelete_Click
>
> End Sub
>
> What it is doing is every time I click the command button on the form where
> I enter and delete the records it moves other fields around and move some
> records to others and keeps moving the records around. Do I need to change
> something to get it to delete the complete row and not move the fields
> around.
>
> I am confused on this one.
> Thanks,
> Pixie
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete records when certain records have duplicate column data JVroom Microsoft Excel New Users 0 26th Jan 2009 05:07 PM
Delete subform records without deleting main form records =?Utf-8?B?QW5pdGE=?= Microsoft Access Form Coding 0 21st Nov 2006 07:00 AM
how do you delete records or update records in a link table. =?Utf-8?B?SGVscG1l?= Microsoft Access Queries 2 18th Aug 2005 05:12 PM
Search for Existing Records and Delete Matching Records =?Utf-8?B?Qm9iIE11bGxlbg==?= Microsoft Access Form Coding 2 1st Jan 2005 12:17 AM
How to delete records from the original table while randomly selecting the records CaribSoft Microsoft Access Queries 2 5th Feb 2004 09:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:17 AM.