[AccessD] A97 Strange Delete Behavior

Wortz, Charles CWortz at tea.state.tx.us
Tue May 20 10:07:39 CDT 2003


That's old Access 2.0 code that M$ seems unable to convert since their
wizards keep generating it.  The first line says to execute the 8th item
on that menu, which in A2.0 was the Select option.  The next line says
to execute the 6th option which was the Delete option.  Of course, if
they change the order of the options on the menu then you are royally
scr*wed.

If it is the table that has focus instead of the record, then you are
selecting and deleting the table, not the record you wanted to delete.

Charles Wortz 
Software Development Division 
Texas Education Agency 
1701 N. Congress Ave 
Austin, TX 78701-1494 
512-463-9493 
CWortz at tea.state.tx.us 
-----Original Message-----
From: Charlotte Foust [mailto:cfoust at infostatsystems.com] 
Sent: Tuesday 2003 May 20 09:53
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] A97 Strange Delete Behavior
Importance: Low


I haven't taken the time to figure out exactly what those two archaic
lines say, but I can tell you what's happening.  You're deleting the
table rather than the record.  If you want to delete a record, just use
this:

DoCmd.RunCommand acCmdDeleteRecord

First, you will want to set the focus back to a data control just to
keep Access from getting confused.

Charlotte Foust
-----Original Message-----
From: Judy Johnson [mailto:jjwrite at earthlink.net] 
Sent: Tuesday, May 20, 2003 3:39 AM
To: AccessD
Subject: [AccessD] A97 Strange Delete Behavior


I'm having a very strange thing occur. Not sure what's going on.

My application consists of a FE and BE. I'm linking properly and my
tables are being updated as expected. However; I added a Delete button
to a data entry form and used the Wizard - Delete Record.

When I launch the delete button the record doesn't get deleted, but the
link to the table, which is the table that the data source SQL statement
is based on, gets deleted. I've used this wizard many times before and
have never had a problem. I'm stumped!

Code that got produced by the wizard:
    Private Sub CmdD_Click()
    On Error GoTo Err_CmdD_Click

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_CmdD_Click:
    Exit Sub

Err_CmdD_Click:
    MsgBox Err.Description
    Resume Exit_CmdD_Click
    
End Sub


Judy Johnson
jjwrite at earthlink.net
860-482-8651
860-309-2484 (cell)


More information about the AccessD mailing list