Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009

    Unanswered: Date Entry on form help

    Hi I have form I enter data to the table is there a way to set up so when I'm entering the data in the form it doesn't get save automatically unless I hit save.


  2. #2
    Join Date
    Dec 2004
    Madison, WI
    Yes. It's called developing forms using a technique called "Unbound Forms". It basically means all the fields are "unbound" (ie. the form doesn't have a recordsource and all the fields on the form have no sourceobject - ie. empty shell so to speak). You then write vba code when the user clicks the "Save" button to open a recordset in code and write the values from the form into the recordset.

    It is the ideal method of coding forms as you don't have a constant connection to the backend tables and it's very quick for users with slow computers/connections. It does take a little bit longer developing this way as you have to do a lot more coding than you would on a bound form but it's well worth it especially on extremely large datasets.

    You'll want to have functions and call them. The functions are like those you were taught in computer classes (for example, 1 function to write/update (save) the date in the recordset from the form entries, 1 function to retrieve the data from the recordset and then display it to the form, and 1 function to delete the recordset from the ID passed to it that's on the form (you'll actually want to utilize the ID (autonumber or Primary Key) in almost all the functions to construct your vba SQL statement in order to return/update when calling those functions. Then you simply code your appropriate buttons to call the necessary functions. (make sure to put in code to question the user if they should close the form without saving their updates.)

    Another method is to write to a "temporary" type table first and then run a query to append that record to the main data table (and then delete the info in the temp table) but this can be problematic if you have multiple users in the same mdb file (you'd need to clone your source mdb file so each user is in their own mdb file or you'll need to identify which record in the temp table is that specific users.) I wouldn't necessariy recommend this method and would highly recommend using the unbound forms technqiue. Unbound forms is a great practice technique for writing code against extremely large datasets (the forms will open very quickly) if you haven't done them already. There are several posts in this forum you can do a search for on the topic (ie. unbound forms) to find out more info.

    There might also be a few other techniques you can use without using unbound forms which other posters might be able to suggest.
    Last edited by pkstormy; 05-23-09 at 04:19.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Nov 2007
    Adelaide, South Australia
    Using unbound forms is also good to prep you for developing for large databases, say a couple of million records here and there.

    However, at the simplest level, you can also use bound forms and stop the save (Cancel = True) in BeforeUpdate for the form unless a button (Save) is clicked.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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