Results 1 to 8 of 8
  1. #1
    hansdbase is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    Nov 2022
    Posts
    33

    insert data into a sql server table from an access form where tables are not linked using vba dao


    I do not want to link any tables from access to sql server. I simply want to use an access form to enter data that is then inserted into a table in a sql server database. I have been connecting with an ODBC driver so I can retrieve data from the SQL Server table from Access, but I can't seem to be able to insert data entered from the access form back to the sql server table. Any help on how I can do this? Thanks.

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    There are a few methods such as writing a pass-through query, binding the form to an ADO recordset (https://learn.microsoft.com/en-us/of...-ado-recordset) or probably the easiest would be to temporarily link the SQL table (in VBA) run your Insert SQL statement then delete the link.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Why are you making it difficult?
    link the table,add your data.

  4. #4
    hansdbase is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    Nov 2022
    Posts
    33
    Thank you. That really helped. I ran an insert and then immediately deleted it.

  5. #5
    hansdbase is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    Nov 2022
    Posts
    33
    Fair question. Because I don't want the users to see or have access to the table. Does that seem reasonable? Or is there a way to have the tables persistently linked without the users being able to access the tables?

  6. #6
    hansdbase is offline Advanced Beginner
    Windows 11 Access 2021
    Join Date
    Nov 2022
    Posts
    33
    Fair question. Because I don't want the users to see or have access to the table. Does that seem reasonable? Or is there a way to have the tables persistently linked without the users being able to access the tables?

  7. #7
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    research using a term similar to "how to secure ms access database"
    Basic users should never be able to get at the tables - at least not with any permissions that allow edits/deletions.
    You don't necessarily have to implement every idea you find.

    Here's one
    https://www.techrepublic.com/article...cess-database/
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,250
    @hansdbase: I used the pass-through and link\delete approach for a similar reason - managing login\user info tables and not wanted them to be available in the front-end navigation bar.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

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

Similar Threads

  1. Replies: 9
    Last Post: 03-22-2021, 05:28 PM
  2. Replies: 3
    Last Post: 07-14-2016, 12:42 AM
  3. Replies: 3
    Last Post: 12-17-2015, 07:01 AM
  4. Replies: 1
    Last Post: 08-20-2013, 11:25 AM
  5. Replies: 3
    Last Post: 01-03-2012, 12:28 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