Query to add a new record to MS Acess.

Posted on 2011-04-19
Last Modified: 2012-05-11
Hi Team,

Can you please provide me a query for my VBA coding.  I am looking at adding new lines into a database using a vba query.
Question by:Sandesh555
    LVL 28

    Assisted Solution

    You'll have to be a little clearer.
    Adding a record into a recordset is pretty easy.
    Suppose you have a table with an autonumber field and an a date field, and you want to add today's date

    dim rs as dao recordset
    set rs = currentdb.openrecordset("YourTable")
    rs!Yourdatefield = Date()
    '(The autonumber field will be automatically updated)
    LVL 40

    Assisted Solution

    by:Vadim Rapp
    The best practice in Access is in in letting Access handle all data manipulation, rather than program it in VBA.

    Author Comment

    Hi vadimrapp1

    I am working on creating a database base which will taken data from MS Outlook (from the given folder) and on the other end this data has to be updated by multiple users as completed.

    Upon completion, it has to be marked as completed in access with the data and time and with the username who marked it completed (username could be taken from the system).

    What is the best solution you propose.
    LVL 40

    Accepted Solution

    I see, it's not native data for Access.

    I would try this first:
    How to retrieve Exchange and Outlook data with the Jet 4.0 OLE DB provider in Access 2000

    Username would have to be put by the code, using Environ("username")

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now