A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

deleting a record on a different form



 
 
Thread Tools Display Modes
  #1  
Old January 16th, 2010, 02:09 PM posted to microsoft.public.access.forms
vircalendar via AccessMonster.com
external usenet poster
 
Posts: 31
Default deleting a record on a different form

I am reposting this to correct a typo. Sorry for the original and any
confusion that reposting may cause.

I have a form with a subform. There is a delete button on the main form that
runs the following delete code to delete a record on the subform:

Private Sub Delete_button_Click()
Dim msg, style, title, Response, MyString
msg = "This action will delete the current record"
style = vbYesNo + vbCritical + vbDefaultButton2
title = "Caution"
Response = MsgBox(msg, style, title)
If Response = vbYes Then
Forms![fmain]![fsub].SetFocus
Forms![fmain]![fsub]!control1.SetFocus
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
End
End If
End Sub

This works fine, but I want to put a timer on the message that ends the
procedure if the user does not respond in a specific period of time. For
workflow reasons, I also want to move the delete button to the subform. Now,
when the user hits the delete button, he opens a separate form (with a timer)
that shows the warning text and has an accept and a reject button. If he
hits accept, the code is:

Private Sub accept_button_Click()
Forms![fmain]![fsub].SetFocus
Forms![fmain]![fsub]!control1.SetFocus
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
End Sub

It's the same code, but running from a different form, and it does nothing.
The record is not deleted. I also tried making the original code (minus the
msgbox) a public sub and changed the code on my second form to

Private Sub accept_button_Click()
Forms![fmain].delete_button
End Sub

but that also did nothing. What am I missing?

--
Message posted via http://www.accessmonster.com

  #2  
Old January 16th, 2010, 07:10 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default deleting a record on a different form

The first form is locking the record so the second form can't delete it. You
have the warnings turned off so it can't tell you that.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"vircalendar via AccessMonster.com" u4313@uwe wrote in message
news:a232fb10c7e10@uwe...
I am reposting this to correct a typo. Sorry for the original and any
confusion that reposting may cause.

I have a form with a subform. There is a delete button on the main form
that
runs the following delete code to delete a record on the subform:

Private Sub Delete_button_Click()
Dim msg, style, title, Response, MyString
msg = "This action will delete the current record"
style = vbYesNo + vbCritical + vbDefaultButton2
title = "Caution"
Response = MsgBox(msg, style, title)
If Response = vbYes Then
Forms![fmain]![fsub].SetFocus
Forms![fmain]![fsub]!control1.SetFocus
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
End
End If
End Sub

This works fine, but I want to put a timer on the message that ends the
procedure if the user does not respond in a specific period of time. For
workflow reasons, I also want to move the delete button to the subform.
Now,
when the user hits the delete button, he opens a separate form (with a
timer)
that shows the warning text and has an accept and a reject button. If he
hits accept, the code is:

Private Sub accept_button_Click()
Forms![fmain]![fsub].SetFocus
Forms![fmain]![fsub]!control1.SetFocus
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
End Sub

It's the same code, but running from a different form, and it does
nothing.
The record is not deleted. I also tried making the original code (minus
the
msgbox) a public sub and changed the code on my second form to

Private Sub accept_button_Click()
Forms![fmain].delete_button
End Sub

but that also did nothing. What am I missing?

--
Message posted via http://www.accessmonster.com



  #3  
Old January 16th, 2010, 09:53 PM posted to microsoft.public.access.forms
vircalendar via AccessMonster.com
external usenet poster
 
Posts: 31
Default deleting a record on a different form

That's a good thought, but the two forms that open via the select case
statement are never open at the same time. And I tried running the code with
warnings enabled and got no warnings.

Arvin Meyer [MVP] wrote:
The first form is locking the record so the second form can't delete it. You
have the warnings turned off so it can't tell you that.
I am reposting this to correct a typo. Sorry for the original and any
confusion that reposting may cause.

[quoted text clipped - 49 lines]

but that also did nothing. What am I missing?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #4  
Old January 16th, 2010, 10:37 PM posted to microsoft.public.access.forms
vircalendar via AccessMonster.com
external usenet poster
 
Posts: 31
Default deleting a record on a different form

I'm mixing up two posts that I have out in cyberspace. Your answer is
correct and my response was not. Thanks.

vircalendar wrote:
I am reposting this to correct a typo. Sorry for the original and any
confusion that reposting may cause.

I have a form with a subform. There is a delete button on the main form that
runs the following delete code to delete a record on the subform:

Private Sub Delete_button_Click()
Dim msg, style, title, Response, MyString
msg = "This action will delete the current record"
style = vbYesNo + vbCritical + vbDefaultButton2
title = "Caution"
Response = MsgBox(msg, style, title)
If Response = vbYes Then
Forms![fmain]![fsub].SetFocus
Forms![fmain]![fsub]!control1.SetFocus
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
End
End If
End Sub

This works fine, but I want to put a timer on the message that ends the
procedure if the user does not respond in a specific period of time. For
workflow reasons, I also want to move the delete button to the subform. Now,
when the user hits the delete button, he opens a separate form (with a timer)
that shows the warning text and has an accept and a reject button. If he
hits accept, the code is:

Private Sub accept_button_Click()
Forms![fmain]![fsub].SetFocus
Forms![fmain]![fsub]!control1.SetFocus
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
End Sub

It's the same code, but running from a different form, and it does nothing.
The record is not deleted. I also tried making the original code (minus the
msgbox) a public sub and changed the code on my second form to

Private Sub accept_button_Click()
Forms![fmain].delete_button
End Sub

but that also did nothing. What am I missing?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #5  
Old January 18th, 2010, 03:58 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default deleting a record on a different form

I'm not sure that we understand one another. You mentioned form and subform.
By definition, they would be open at the same time.

Some warning messages are affected by a setting in Options: Tools
Options Edit/Find Confirm. There are 3 checkboxes that must be
checked to show all the warnings for those items.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"vircalendar via AccessMonster.com" u4313@uwe wrote in message
news:a23709dc1c51d@uwe...
That's a good thought, but the two forms that open via the select case
statement are never open at the same time. And I tried running the code
with
warnings enabled and got no warnings.

Arvin Meyer [MVP] wrote:
The first form is locking the record so the second form can't delete it.
You
have the warnings turned off so it can't tell you that.
I am reposting this to correct a typo. Sorry for the original and any
confusion that reposting may cause.

[quoted text clipped - 49 lines]

but that also did nothing. What am I missing?


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:25 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.