Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / July 2007

Tip: Looking for answers? Try searching our database.

after delete record, new record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
deb - 30 Jul 2007 20:04 GMT
I would like to be able to click the delete button on my form (which has a
subform)and have it delete the record and then have the form set to New
Record.
Below is my code but it bombs on moving to a new record New record
msg... the command or action RecordsGoToNew isn't available now.

Can you help??

Private Sub btnDeleteCI_Click()
On Error GoTo Err_btnDeleteCI_Click

Me.AllowEdits = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowEdits = True
Me.AllowDeletions = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowDeletions =
True
Me.AllowAdditions = True
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.AllowAdditions =
True

Msg = "Are you sure you want to delete this Customer Impact? This will
delete the entire Customer Impact record."
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then
MsgBox "The Customer Impact has NOT been deleted."
Exit Sub
Else
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
MsgBox "The Customer Impact has been deleted."
End If

Me.Refresh
Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.Refresh
DoCmd.RunCommand acCmdRecordsGoToNew
Signature

deb

Wayne-I-M - 30 Jul 2007 21:06 GMT
Hi Deb

You don't need the refresh and also move the new record line up

Msg = "Are you sure you want to delete this Customer Impact? This will
delete the entire Customer Impact record."
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbNo Then
MsgBox "The Customer Impact has NOT been deleted."
Exit Sub
Else
   DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
   DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
   DoCmd.GoToRecord , , acNewRec
End If

Signature

Wayne
Manchester, England.

> I would like to be able to click the delete button on my form (which has a
> subform)and have it delete the record and then have the form set to New
[quoted text clipped - 31 lines]
> Forms!f2CustImpactsEdit.Form!f2CustImpactsEditDetails.Form.Refresh
> DoCmd.RunCommand acCmdRecordsGoToNew
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.