Results 1 to 6 of 6
  1. #1
    THE STUDENT is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    11

    Question Programming of 'SAVE' button in Access 2010

    Good day all, im currently in the process of attempting to achieve validations for my customer form, one of the issue that I just cant seem to resolve is getting my save button to function properly, meaning that once data is on the form that already exists within the database and should the user click save nothing should happen or maybe a message pop up saying that the function cannot execute. The only time the button should function is when there is new customer data (when the 'Add New Customer' button is pressed) and after the details saved a msg confirming such. Im not to good with the use of code as im trying to fix this using the form and button properties but to no avail.


    Can anyone advise on how to achieve such, and if possible is there anyway to make the button solid and only when the 'Add New Customer' button is pressed it will then initialize?


    Please Advise


    The Student

  2. #2
    mike02 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    245
    on form open even type this
    Code:
    Cmd_Save.Enabled = False
    Then on the code for New customer type this underneath it:
    Code:
    Cmd_Save.Enabled = True
    Note: Assuming your save button is named Cmd_Save
    Hope that helps,

  3. #3
    THE STUDENT is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    11
    can u be abit more clear michael, im I doing that within the VB code page? and if I should change the save button to false will if not become dis-functional?
    Im new to access, hope my questions are not dumb

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    Record validation should be done in the forms Before Update event because that event always fires, as its name would suggest, just before the record is saved. In that event the update can be cancelled if the validation fails. The only code you need for the "Save" button would be something to make the record update. Something like:
    Code:
    If Me.Dirty Then
      Me.Dirty = False
    End If
    I would not bother with a "Save" button. IMHO it serves no real purpose. When the user does something to close the form or move to another record Access will automatically save the the record and the forms Before Update event will fire.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    THE STUDENT is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    11
    This is being done for an assignment Bob, so I cannot exit the form without saving the info first during my presentation, that would be poor coding on my behalf, I really need this to function with the save button and i need that button to function only when new data is on the form

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    Then use the code I gave in post #4
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. VB programming Access 2010
    By engr_saud1 in forum Programming
    Replies: 2
    Last Post: 05-31-2013, 04:30 PM
  2. Replies: 3
    Last Post: 10-08-2012, 08:40 AM
  3. Save a access 2010 db as 2007 db
    By duncan cameron in forum Access
    Replies: 2
    Last Post: 08-30-2012, 10:37 AM
  4. Save Access 2010 as .SQL
    By rthomaskelly in forum Access
    Replies: 1
    Last Post: 04-01-2012, 03:37 PM
  5. mdb save problems with Access 2010
    By pacnwWill in forum Programming
    Replies: 3
    Last Post: 09-27-2011, 11:52 AM

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