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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|