Results 1 to 8 of 8
  1. #1
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591

    How to wipe a form

    I have a data entry form with a Save Record button and a Close button. Right now if the user clicks the close button a partially entered records is put in the table. Do I have to wipe the form first using me.Field1 = "", me.Field2 = "" etc.? or something else?

    Hope you can help,

    Paul

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481
    Did you put default values in the fields when you set up the form? (In the Property sheet)
    Last edited by hertfordkc; 10-12-2011 at 11:51 AM. Reason: Incomplete

  3. #3
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Yes, a couple of them.

  4. #4
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481
    I misunderstood your question. Your are wanting to prevent the writing of an incomplete record to your table...right?
    If so, I've handled that with VB code in the Form_BeforeUpdate event. If the entries are incomplete, Docmd.CancelEvent and DoCmd.Close (or other error handling).

  5. #5
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Quote Originally Posted by hertfordkc View Post
    I misunderstood your question. Your are wanting to prevent the writing of an incomplete record to your table...right?
    Yes

    Quote Originally Posted by hertfordkc View Post
    I've handled that with VB code in the Form_BeforeUpdate event. If the entries are incomplete, Docmd.CancelEvent
    How do I define an incomplete record with a dozen field, but only 4 required?
    Is there a better way than this?

    Code:
     intResponse = MsgBox("Save record?", vbCritical + vbYesNo)
    If intResponse = vbNo Then DoCmd.CancelEvent

  6. #6
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    Really I need this to run off the cmdClose_click event. If they click the Close button the records never gets saved.

    Even better, if I hit Esc (wiping the form clean), then click close, I get just the effect that I want.

  7. #7
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    In the close button's click event you can use:

    Me.Undo

  8. #8
    Paul H's Avatar
    Paul H is offline Expert
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Location
    Richmond, VA
    Posts
    591
    You're a gentleman and a scholar.

    Thanks

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums