[AccessD] one more tip for help...

Steve Schapel steve at datamanagementsolutions.biz
Thu Mar 30 14:03:38 CDT 2017


Hi Kostas

I think the problem is that you can't delete the record until there is one 
to delete.  The record has not been saved at this point, so trying to delete 
it won't work.

Maybe try:
Cancel = True
Me.Undo

Regards
Steve

-----Original Message----- 
From: Kostas Konstantinidis
Sent: Friday, March 31, 2017 6:18 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] one more tip for help...

Hi Dan,
Thank's for your response..
What I need is when the user select NO from the message panel to be able to
delete the current record...

The logic is
On new record is the user forget to complete [date1] to close the message
(clicking YES) and [date1] to get in set focus again... until he will decide
if he wants to proceed to current record or not

If IsNull(date1) Then
Msg = "Select OK to continue or No to delete current record"
Style = vbYesNo
Title = "Choose"
responce = MsgBox(Msg, Style, Title)
If responce = vbYes Then
Me.date1.SetFocus
Cancel = True
Till here everything works perfect

The problem is after the 'else' point
If for any reason like e.g. by mistake the user do create a new record  to
be able to delete it...

Thank's
/kostas



-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan
Waters
Sent: Thursday, March 30, 2017 4:20 PM
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] one more tip for help...

Hi Kostas,

This is something you could try:

    If Me.NewRecord = False Then
        Me.AllowDeletions = True
        DoCmd.RunCommand acCmdDeleteRecord
        Me.AllowDeletions = False
    End If

Dan

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Kostas Konstantinidis
Sent: Thursday, March 30, 2017 03:46
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] one more tip for help...


HI again,
It works with YES but not in NO
Am I missing something?
Thank's
kostas

If IsNull(date1) Then
Msg = "Select OK to continue or No to delete current record"
Style = vbYesNo
Title = "Choose"
responce = MsgBox(Msg, Style, Title)
If responce = vbYes Then
Me.date1.SetFocus
Cancel = True
Else
DoCmd.RunCommand acCmdDeleteRecord
End If
End If
End If
End Sub



-- 
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 



More information about the AccessD mailing list