save data from form to text file.

Posted on 2009-04-28
Last Modified: 2013-11-28
I have about 14 concurrent user using an access form on their desktop.  They keep locking each other out of the database. The database is split with the frontend ( forms, queries, reports and some tables used to feed dropdown lists) on the PC.  The data tables reside on the network.  I form is currently bound to the backend tables.  I would like to make the form unbound with a submissions that would insert the form record info the a text file,  then link the text file to the backend.  This should eliminate the concurrent user conflicts.   The form only has 4 elements so I think that is the best solution.

Question by:eyes59
    LVL 11

    Accepted Solution

    You would need to create VBA subs to read/write records, and fire getRecord from a listbox and save record from a command button.
    Example below using genering table/control names.

    Sub GetRecord()        
            Dim rs as dao.recordset
            set rs = currentdb.openrecordset("SELECT * FROM tblRecord WHERE RecID=" & NZ(me.lboRecordID,0))
            With rs
                 If .eof then
                         me.txtRecordName.value = .fields("sRecordName").value
                         me.txtRecordNo.value = .fields("sRecordNo").value
                         me.txtRecordDate.value = .fields("dRecordDate").value
                         me.chkRecordActive.value = .fields("bRecordActive").value
                         me.txtRecordName.value = .fields("sRecordName").value
                         me.txtRecordNo.value = .fields("iRecordNo").value
                         me.txtRecordDate.value = .fields("dRecordDate").value
                         me.chkRecordActive.value = .fields("bRecordActive").value
                 End If
             End with
             set rs = nothing
    End Sub

    Sub SaveRecord()
             Dim rs as dao.recordset
            set rs = currentdb.openrecordset("SELECT * FROM tblRecord WHERE RecID=" & NZ(me.lboRecordID,0),dbOpenDynaset,dbSeeChanges)
            With rs
                  If .eof then .addnew else .edit
                  .fields("sRecordName").value = me.txtRecordName.value
                  .fields("iRecordNo").value = me.txtRecordNo.value
                  .fields("dRecordDate").value = me.txtRecordDate.value
                  .fields("bRecordActive").value = me.chkRecordActive.value
             End with
             set rs = nothing
             me.lboRecordID.value = null
    End Sub


    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    This collection of functions covers all the normal rounding methods of just about any numeric value.
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    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 …
    The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

    759 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

    12 Experts available now in Live!

    Get 1:1 Help Now