Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    tia is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    12

    Save button


    I need to know what code to type so that after I click the save button all the data in the form will be saved in the table.thank you

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Is the form bound (has a RecordSource) and controls are bound (have ControlSource). If so, data enter into controls is entered directly to table. The inputs are committed to table record when the form closes, move to another record, or run code: DoCmd.RunCommand acCmdSaveRecord
    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
    tia is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    12
    I am new to access i don't know if my form is bound. How do I know if it is bound or unbound? if it is bound/unbound what do i do? I need to have a save button because it's an assignment in one of my subjects.Thank You.

  4. #4
    coolpal9 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    40
    Yeah tia is right.

    If RecordSource is not set, then how to set it?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Form in design view, open Properties sheet, select Data tab, look at form's RecordSource property. Anything in there?

    Access Help has guidelines on creating bound form. Search topic: create form. This is basic Access functionality.

    If your assignment is to use an unbound form, the code to save data will be more complicated.

    Google: Access VBA save data unbound form
    Here is one http://www.databaselessons.com/unbound-forms-1.php
    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.

  6. #6
    coolpal9 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    40
    Here against Record Source there is nothing written. But there is a drop down list containing a list of tables, queries etc.

    I have selected the respective tables to which I wish to send the data.

    But what about the Control Source?

  7. #7
    tia is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    12
    I think my table is bound. I need help on what to do in order to save the record using an unbound form. I hope you can help me with this. I am attaching a copy of my assignment. thank you so much for your help.

  8. #8
    coolpal9 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    40
    Thanks a lot June7! Your help was much needed! Finally done!

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    tia, I gave you a link to a tutorial for what you want to do.
    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.

  10. #10
    coolpal9 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    40
    Hey one query...

    In my form, wherever there is a combo-box containing Yes/No fields, the default in the form view shows #Error.

    And once the form gets to fill up, #Error changes to:
    -1 for Yes
    and 0 for No

    How to rectify this problem? The form doesn't look good if the default value is #Error or -1/0.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    I don't know why showing #Error. The control is bound?

    You can set the Format property of control to display Yes/No instead of -1/0.
    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.

  12. #12
    coolpal9 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    40
    Yeah, thank you! Its working.

    Can you pl tell me how to refresh the form, as in, whenever I open the form in form view, it contains the details of the last entry. I want the form to look fresh to fill up.
    Can you suggest me as to what I should do?

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    Don't understand what you mean by 'contains the details of the last entry'. How does this make the form look 'fresh'?
    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.

  14. #14
    coolpal9 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    40
    I mean when the form is opened, the fields should be un-filled. Right now, when I open the form, I get the fields with values of the previous entry.

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    You can either set the form to always open to a new record, in which case it would never show existing records. Or can use code to open to new record. I use only VBA:

    DoCmd.OpenForm "formname", , , , acFormAdd

    Why does it show previous entry? Do you have records sorting DESCENDING?
    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.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. do NOT save record on close (x button)
    By benjammin in forum Forms
    Replies: 12
    Last Post: 03-15-2013, 02:54 AM
  2. Replies: 7
    Last Post: 11-23-2011, 08:14 PM
  3. Save button say syntax error
    By venu_resoju in forum Forms
    Replies: 6
    Last Post: 02-14-2011, 02:52 AM
  4. Help Require (Macro Save button )?????
    By aligahk06 in forum Access
    Replies: 1
    Last Post: 04-18-2010, 08:38 AM
  5. Save to PDF Button?
    By SpeedyApocalypse in forum Forms
    Replies: 2
    Last Post: 04-10-2010, 06:06 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