jwcolby
jwcolby at colbyconsulting.com
Tue Mar 25 08:34:53 CDT 2008
And then me.requery immediately AFTER the delete record
John W. Colby
Colby Consulting
www.ColbyConsulting.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo
Sent: Tuesday, March 25, 2008 9:22 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Cancel Produces Error
Stick Me.dirty= false immediately before DoCmd.RunCommand acCmdDeleteRecord
Max
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Tuesday, March 25, 2008 12:51 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Cancel Produces Error
Yes Rocky I'm serious. Like I said - eventually, in a bound form.
Once in a while, DoCmd.RunCommand acCmdDeleteRecord would not work and I
wasn't able to find out why.
Saving the records? Of course.
Remove/replace the recordset? What would your form be looking at once you
delete the record - a bunch of fields with Name# in them? Also, you
probably want to display a blank record or perhaps move to a specific
record.
Turn echo off/on? Your users may worry about all that screen flashing.
I'm recommending this because you'll get predictable results!
Dan
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Monday, March 24, 2008 10:00 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Cancel Produces Error
(Is he serious?)
Rocky
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Monday, March 24, 2008 6:08 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Cancel Produces Error
Hi Rocky,
Eventually I found that only the following would consistently delete a
record in a bound form.
Step 0: Stop screen redisplay
Application.Echo False
Step 1: Save any unsaved record(s)
If Me.Dirty = True Then Me.Dirty = False
Step 2: Save the record ID
lngTableID = txtTableID
Step 3: Remove the recordsource from the form Me.Recordsource = ""
Step 4: Delete the record
Stg = "DELETE * FROM tblTable WHERE TableID = " & lngTableID
DoCmd.SetWarnings False DoCmd.RunSQL stg DoCmd.SetWarnings True
Step 5: Replace the recordsource (optional) Me.Recordsource = [something]
Step 6: Redisplay the screen (you must error trap this procedure
and include this same line if the procedure errors out)
Application.Echo True
Good Luck!
Dan
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Monday, March 24, 2008 6:07 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Cancel Produces Error
Dear List:
The following code for deleting a record, generated by the wiz errors on the
second statement if the user clicks cancel to the warning message.
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Is there a right way around this? Placing On Error Resume Next between the
statements would probably work but doesn't seem right.
MTIA
Rocky
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.519 / Virus Database: 269.22.0/1341 - Release Date: 3/24/2008
3:03 PM
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com