Results 1 to 4 of 4
  1. #1
    TheHarr is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Mar 2016
    Posts
    1

    Post How to insert a record using command button in a form


    I created a form to insert new records and have a command button that executes the saverecord command. I used message boxes to verify the code executs, but the record does not get inserted. I expect the form to insert the record in the datasheet and clear out the entry fields. Instead--nothing. Just the messagebox displays. The data will save when I close/open the datasheet. I'm sure access is not suppose to work this way in development. Can someone direct me to online documentation that describes the insert record macro code? I'll keep looking for the answer and will check in for help. Thank you in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    Turn on the control wizard, then grab a button, put it on a form.
    the wiz will ask what to do,
    select records,then save record.
    when done, look at the click proprty.
    THATS the code.

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The easiest way is to set up the form for data entry only. Create a button to go to a new record. Done. But be aware that the form will not show previous entered records.

    Create a test form.
    Open the Test form in design view.
    Click on the DATA tab.
    Find the "Data Entry" property and change it to "YES".

    You can only enter data into the form.....

  4. #4
    shadowsedge is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2016
    Posts
    19
    Ok, I tried this and got as far as opening the test form in design view. No data tab anywhere. Access 2016

    Update: Ok, I found it. The "data tab" is in the "property sheet" only if you are not using the "add existing field".

    thx again!

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

Similar Threads

  1. Replies: 11
    Last Post: 05-15-2015, 05:23 PM
  2. Replies: 2
    Last Post: 04-02-2015, 08:04 PM
  3. Replies: 6
    Last Post: 12-30-2014, 10:05 PM
  4. Replies: 2
    Last Post: 05-11-2012, 11:52 AM
  5. Replies: 5
    Last Post: 03-04-2012, 01:21 PM

Tags for this Thread

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