Results 1 to 5 of 5
  1. #1
    eugzl is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2021
    Posts
    68

    add new record from form to DB table

    Hi All.
    I created my first form which include cascaded combo boxes and some text boxes. Now I would like to modify it to give user ability to save selected values from combo boxes and entered date to text boxes from form to DB table. How create VBA code to perform save event? I will appreciate if someone will explain and show by sample how it to do.



    Thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    Don't need VBA. Bind form to table and controls to fields. Data input/selected will pass directly to table. This is basic Access functionality and a major benefit of using Access as GUI.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    eugzl is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2021
    Posts
    68
    Hi June7.
    I would like create the form with such options:
    1. The form should have options to check validate data and validate of the required fields
    2. if all validations are OK, enable the SAVE button to give user ability to save record
    3. when save button is clicked it will initialize all form's fields to give user ability to create another new record

    Thanks
    Last edited by eugzl; 11-14-2021 at 07:16 PM.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,953
    Validation can be done with bound form and controls. That's what the BeforeUpdate event is for. Also have ValidationRule property of controls.

    A record is committed to table when: 1) close table/query/form; or 2) move to another record; or 3) run code to save.

    So all button needs to do is move to new record row and the initial record is committed and form is ready for user input to a new record.

    Can use unbound form and controls for data entry if you want - I never have.

    This is a common topic so many examples. At least 2 methods for saving data from unbound form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,568
    Hi
    Upload a zipped copy of the database so we can take a look at your structure.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

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

Similar Threads

  1. Replies: 1
    Last Post: 12-11-2018, 01:24 PM
  2. Replies: 2
    Last Post: 09-25-2018, 05:33 PM
  3. Replies: 4
    Last Post: 02-18-2015, 11:28 AM
  4. Replies: 4
    Last Post: 01-20-2015, 12:55 PM
  5. Replies: 3
    Last Post: 08-09-2012, 01:49 PM

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