Results 1 to 8 of 8
  1. #1
    ninjamustang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    11

    Access 2010 web database, how do I save records to a table?

    Hello,



    I'm using Access 2010, and created a web database which i'm now trying to save a selected record to another table which I have no clue where to find the "Code Builder" to put my code on after spending hours and hours, I managed to create a form, but couldn't figure out where to save this data.

    All I need is to put this line
    "INSERT INTO ResultTable (StudentID, CourseID, PaidID, Comments) VALUES (" & cboStudentSelect & ", " & cboCourseSelect & ", " & cboPaymentSelect & ", " & txtComments & ") WHERE StudentID = cboStudentSelect

    Perhaps, the new Access 2010 doesn't use this or something new that I couldn't it.

    Attached is the file.

    Thank you for your help in advance.
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    The WHERE clause is meaningless for an INSERT, remove it. Values for text field need apostrophe delimiters: & ", '" & txtComments & "')"

    Why do you need to do this as opposed to data entry with a 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.

  3. #3
    ninjamustang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    11
    Hello,

    So the data I query from StudentTable, PaidTable, and CourseTable, the form I made give filter Course, Student, and I select PaymentName in the PaidTable for Yes/No. Click Update Payment button and the data would save into a new table called ResultTable where I store value, StudentID, PaidID, CourseID and Comments is the text input from user.

    Maybe I don't explain well, but if you don't mind open the db I attached and you'll see what I'm trying to accomplish.

    Thanks again for the help.

  4. #4
    ninjamustang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    11
    Why do you need to do this as opposed to data entry with a form?

    Oh, this is because I only want user to select a particular record to update and not accidentally pick other record to update by mistake.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    That doesn't make sense to me.

    INSERT doesn't update a record, it creates a new record.

    Wait, think I understand now. You want to add a new record to update student payment history.

    Instead of SQL action, bind the form to the Results table and bind controls to fields and set the form to DataEntry Yes. This will only allow new records and will not display existing records.
    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
    ninjamustang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    11
    Thank you! I changed form to bind ResultTable and form set to DataEntry Yes, and it did the job. However, can I made a button to click save instead of whatever i selected it's saved automatically? This way if the entry can only be saved when I click the save button.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    On bound form with bound controls, data is committed to table when form closes, move to another record, or run code. If you want to require user to confirm they really want to save this data, disable the X close button on the form. Have Cancel and Save buttons. If they click Cancel then code will undo the entries and close form. If they click Save then do one of the 3 actions I listed.

    Otherwise, use unbound controls and have code populate fields of the form RecordSource when Save button is clicked (then close form or move to another record), like:

    Me!StudentID = Me.tbxStudentID
    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.

  8. #8
    ninjamustang is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2014
    Posts
    11
    Thanks so much for your help!

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

Similar Threads

  1. Replies: 2
    Last Post: 01-12-2014, 04:47 AM
  2. Replies: 2
    Last Post: 11-12-2013, 12:50 PM
  3. Save a access 2010 db as 2007 db
    By duncan cameron in forum Access
    Replies: 2
    Last Post: 08-30-2012, 10:37 AM
  4. Save Access 2010 as .SQL
    By rthomaskelly in forum Access
    Replies: 1
    Last Post: 04-01-2012, 03:37 PM
  5. mdb save problems with Access 2010
    By pacnwWill in forum Programming
    Replies: 3
    Last Post: 09-27-2011, 11:52 AM

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