Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2004
    Posts
    47

    Unanswered: Adding new record using a pop-up form

    Hello,

    I am kinda new to Access so please bear with me.

    I have a table with data that is previewed with a form. I want to add an
    "Add Record" button to that form which will open a pop-up form. When that pop-up form is filled out, the user can click "Save" to save it to the initial table or cancel to cancel this.

    Any ideas?

    Thank you

  2. #2
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    create a pop up dialog form with form wizard based on your table. then open it in Add mode with a button on main form. you can do it with follwoing code in your Add Record button.

    Docmd.OpenForm "YourAddDialogFormName",,,,acFormAdd,acDialog
    ghozy.

  3. #3
    Join Date
    Sep 2004
    Posts
    47

    Thank you

    Thank you. It worked.

  4. #4
    Join Date
    Sep 2004
    Posts
    47

    Wondering

    I was wondering if someone could help me with the Cancel button. I want to make it in such a way that when the user hits it the pop-up form closes without saving the information. I tried with:

    Code:
    DoCmd.Close acForm, acName, acSaveNo
    But it does not work. Any ideas?

    Thank you a lot.

  5. #5
    Join Date
    Sep 2004
    Posts
    47

    Found it

    That code did not work for me but this does:

    if Me.Dirty then me.undo
    docmd.close

    Why isn't the previous one working? Is it because I am using Access 2000?

  6. #6
    Join Date
    Jun 2004
    Location
    Florida, US
    Posts
    521
    no its works actually. what acSaveNo does is forbids Access to save form information when you close the form (changed colors, filters, etc), not the underlying data.

    if Me.Dirty then me.undo
    docmd.close

    is the usual way to do it. you are on the right track.
    ghozy.

  7. #7
    Join Date
    Sep 2004
    Posts
    47

    Thanks

    Thanks for the info. Appreciate it!

Posting Permissions

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