Results 1 to 3 of 3

Thread: Save Button

  1. #1
    Join Date
    Sep 2004

    Unanswered: Save Button

    Hi All,

    I am new to this but as part of my new job I have develop a database in MS Access XP using the VB editor within it. My Problem is this, I have a save button within my form, I want an OK/Cancel message to appear on screen. When I put the code in my sub to display a message it does! But i cannot add an IF statement to the code, when I do there is always a compile error, I have tried to declare my variables but this doesn't work either. Is there any chance someone would be kind enough to supply me with some code which will allow me to do this. I cannot use SQL as it is not allowed to be installed on my computer.

    Thanx very much


  2. #2
    Join Date
    Jul 2004
    Ok thry this:

    Create your own message box basically with the OK and Cancel buttons on it. I can forward one from an Access 97 database if you'd like.

    On the save button add this code for the on click:

    Private Sub save_Click()
    DoCmd.OpenForm "Sure"
    End Sub

    go to the custom message box form and in the Ok code type this:

    Private Sub ok_click()
    DoCmd.Save (acDefault|acForm|acMacro|acModule|acQuery|acRepor t|acTable, [ObjectName]) 'pick the ac mode that suits your requirements
    End Sub

    For the Cancel button:

    Private Sub cancel_Click()
    End Sub

    this should do what you are looking for. Not exactly cutting edge coding, but does the job.

  3. #3
    Join Date
    Sep 2004

    Smile Thanx

    Could you forward the 97 one


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts