Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 4th, 2004, 01:13 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default #Deleted refresh error


I have created an if statement that handles a delete request for my delete command button as follows:

DoCmd.SetWarnings False ' Turn off Access warning messages

  If MsgBox("Would you like to delete current record? ", vbYesNo, "Delete Record") = _
                    vbYes Then
        DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
        DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
        DoCmd.SetWarnings True ' Warning set on again
        DoCmd.GoToRecord , , acFirst ' Return to first record in database
  Else
        DoCmd.SetWarnings True ' Warning set on again
        Exit Sub
  End If

The code works fine. My problem is the form that uses this code, as it acts as both an entry form and record navigation form. On the form I have provided a quick search function in the form of a combo box. My problem is that as soon as a relevant record is deleted the wording #Deleted appears to represent the now deleted record. Is there away that I might be able to refresh the combo box to take into account the change in the database data?

I really appreciate somebody's help, The database is almost complete I am just trying to overcome these minor bugs.

Garry

Gaz
__________________
Gaz
 
Old March 4th, 2004, 01:17 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Modify your code as follows by first moving your turning off of the warning message.

Code:
  If MsgBox("Would you like to delete current record? ", vbYesNo, "Delete Record") = _
                    vbYes Then
        DoCmd.SetWarnings False ' Turn off Access warning messages
        DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
        DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
        DoCmd.SetWarnings True ' Warning set on again
        me.comboboxname.requery
        DoCmd.GoToRecord , , acFirst ' Return to first record in database
  Else
        Exit Sub
  End If


Beth M
 
Old March 4th, 2004, 01:27 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 137
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Beth, You truly are the Gandalf of MS Access :-)

Gaz
 
Old March 4th, 2004, 02:00 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Gaz,

Naaa, I'm still just a 'grasshopper', but happy to be of assistance. :D

Beth





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error when refresh the page! heba ASP.NET 2.0 Professional 3 June 6th, 2007 08:32 AM
Refresh error message Bob Bedell ASP.NET 1.0 and 1.1 Professional 1 November 27th, 2006 02:25 PM
Record Deleted Error Message VB6 akash BOOK: Expert One-on-One Access Application Development 0 March 8th, 2005 06:53 AM
deleted bcmaverik VB.NET 2002/2003 Basics 0 March 13th, 2004 06:25 AM
Refresh causing Query Engine Error Deecay Crystal Reports 0 July 10th, 2003 09:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.