Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Locked table problem

Discussion in 'Information Technology' started by Phil Hellmuth, Jul 28, 2006.

  1. Phil Hellmuth

    Phil Hellmuth
    Expand Collapse
    Guest

    I have a form that has an After Insert event. During the event, a row
    is inserted into a table which is the record source of a subform on the
    form. When inserting a row on the form, all goes as planned. If the
    form is open in Datasheet view, and insert a record, again, all goes as
    designed. However, if I attempt to paste/append multiple rows, each
    attempt to add a row in the After Insert event fails with a
    "could not read the record; currently locked by another user." message.
    Googling this message returned no results.

    Any suggestions? Thanks in advance.
     
  2. Loading...

    Similar Threads Forum Date
    India Raid finds several schools locked Breaking News Sep 23, 2012
    Sikh News Jagdish Tytler's UK visit blocked over 1984 Sikh Massacre Breaking News Nov 6, 2009
    As A Child, Public Marches Of Sikhism Made Me Uncomfortable. They Still Do . Why ? Whats The Logic Hard Talk Oct 16, 2016
    Arts/Society Backyard Vegetable Garden Language, Arts & Culture Dec 27, 2013
    Heritage Now a Vegetable Market, Ranjit Singh's Royal Haveli a Picture of Neglect History of Sikhism Nov 11, 2013

  3. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Hi Phil,

    What method are you using to insert rows? I would suggest
    an APPEND Query...

    '~~~~~~~~~~~~~~~~~
    dim strSQL as string
    strSQL = "INSERT INTO Tablename " _
    "(numfield, strfield, datefield ) " _
    "SELECT " & NumVariable & ", '" _
    & strVariable & "', #" _
    & dateVariable & "#;"
    debug.print strSQL
    currentdb.execute strSQL

    currentdb.tabledefs.refresh
    DoEvents
    me.subform_controlname.form.requery
    '~~~~~~~~~~~~~~~~~


    ** debug.print ***

    debug.print strSQL

    --> this prints a copy of the SQL statement to the debug
    window (CTRL-G)

    After you execute your code, open the Debug window
    CTRL-G to Goto the debuG window -- look at the SQL statement

    If the SQL statement has an error

    1. Make a new query (design view)

    2. choose View, SQL from the menu
    (or SQL from the toolbar, first icon)

    3. cut the SQL statement from the debug window
    (select, CTRL-X)

    4. paste into the SQL window of the Query
    (CTRL-V)

    5. run ! from the SQL window
    -- Access will tell you where the problem is in the SQL


    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    Phil Hellmuth wrote:
    > I have a form that has an After Insert event. During the event, a row
    > is inserted into a table which is the record source of a subform on the
    > form. When inserting a row on the form, all goes as planned. If the
    > form is open in Datasheet view, and insert a record, again, all goes as
    > designed. However, if I attempt to paste/append multiple rows, each
    > attempt to add a row in the After Insert event fails with a
    > "could not read the record; currently locked by another user." message.
    > Googling this message returned no results.
    >
    > Any suggestions? Thanks in advance.
     

Share This Page