Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > All Other Wrox Books
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
All Other Wrox Books Do you have a question about a Wrox book that isn't listed anywhere on p2p.wrox.com or where the forum is locked? Here's a forum to post questions about any other Wrox book so that other readers or one of the authors can help you with your questions. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the All Other Wrox Books section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 16th, 2003, 09:20 AM
Registered User
Join Date: Jul 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning Visual Basic 6 Database Programming

Below is a chunk of code that I'm running from chapter 6.

Private Sub cmdButton_Click(Index As Integer)
  Static vMyBookMark As Variant
  Select Case Index 'what is the value of the key pressed?
    Case cmdMoveFirst
    Case cmdMovePrevious
    Case cmdMoveNext
    Case cmdMoveLast
    Case cmdAddNew
    Case cmdEdit
      With Data1.Recordset
        If (.EditMode = dbEditNone) Then
          vMyBookMark = .Bookmark
          Call updateButtons
          lblRecordCount = "Editing"
        End If
      End With
    Case cmdSave
    Case cmdDelete
    Case cmdUndo
    Case cmdFind
    Case cmdDone
  End Select
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  Dim iMessage As Integer

  If (Data1.Recordset.EditMode <> dbEditNone) Then
    iMessage = MsgBox("You must complete editing the _
     current record", vbInformation, App.EXEName)
    Cancel = True
  End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Set frmPublishers = Nothing
End Sub

The code is suppose to prevent the user from closing down the form or window when they are in the middle of editing a record. The problem is the expression "Data1.Recordset.EditMode <> dbEditNone" in the if statement never becomes true like the book says it should. The Data1.Recordset.EditMode = vbEditInProgress after the Case cmdEdit runs the .Edit method. But as soon as the code reaches Private Sub Form_QueryUnload the Data1.Recordset.EditMode changes to vbEditNone!

Thanks in advance,

Closed Thread

Thread Tools Search this Thread
Search this Thread:

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning Visual Basic 6 database zach007 Wrox Book Feedback 1 January 24th, 2006 11:42 PM
Beginning Visual basic 6.0 DataBase visualizebasic Wrox Book Feedback 0 June 14th, 2005 03:41 AM
Chapter6 - Beginning Visual Basic 6 Database Prog. jdeaver VB Databases Basics 1 September 29th, 2004 11:01 AM
beginning visual basic 6 database programming gskarns1 VB Databases Basics 1 September 29th, 2004 10:46 AM
Beginning Visual Basic 6 Database Programming lizardnotebk All Other Wrox Books 1 December 16th, 2003 01:45 PM

All times are GMT -4. The time now is 09:19 PM.

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