Results 1 to 8 of 8
  1. #1
    Ostio is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2019
    Posts
    3

    Query to take form input and add it as a new row to table

    Hello,



    Recently I have started a project on access. Note that I am very familiar with Excel vba but very new to Access in general.

    So I have created a form on access with around 20 things the user has to input, and given specific names to all of them(ex. txtDate, txtName, optShift) thinking I could insert a button with a code that would transfer the info in a separate table in a new row, hidden from public eye. My Excel mind thought it would be something like (not in code form cause it's not real code) :
    Tables("dbResults").Cells( n + 1 ,1).value = Forms("ufABC").txtDate.Value
    Of course, the "n + 1" doesn't mean anything, I'm just pointing that it has to go into a new row.

    The problem is that Access works with queries, and I don't understand how to use them to make what I want. I want a submit button at the bottom of the form that sends the data to a table and clears all the fields in the form. I know I am not very clear, so feel free to ask me some questions.

    Can someone help me with that?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You could use a query but the simplest (and most common) solution is to make the form's record source the table and each control's control source the appropriate field in that table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Ostio is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2019
    Posts
    3
    Thank you for your quick response,

    I have tried that, but it allows the user to navigate through the entries, which I don't want. Is there a way to remove that?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Change the Data Entry property of the form to Yes.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Uncle Gizmo is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    26
    Just to let you know this is has been cross posted at access world forums https://www.access-programmers.co.uk...d.php?t=305650 where I provided essentially the same answer! Please be advised that there's nothing wrong with doing cross posting but if you don't tell people, then you risk making people Cross!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Ostio is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2019
    Posts
    3
    Thank you!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 6
    Last Post: 03-14-2019, 03:39 PM
  2. Replies: 5
    Last Post: 06-25-2017, 01:24 PM
  3. Replies: 1
    Last Post: 11-04-2014, 12:07 PM
  4. Replies: 6
    Last Post: 10-27-2014, 08:05 PM
  5. Replies: 2
    Last Post: 05-27-2011, 05:55 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