Results 1 to 3 of 3
  1. #1
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936

    Timing issue

    I seem to be having a timing issue with my code. I open another database, read through the field list of a query (name supplied) and write each field in the query to a local table. Then I close the database (dbs.close).

    Next I create a query based on this local table which a form uses to show the field names. Often the form tries to open but the query doesn't yet exist, and sometimes the other database is still open when the code is already here.

    It seems to be a timing issue, I don't know very much about this and wondered if anyone could help with knowing how to tell when the first part is complete before continuing with the second.

  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,518
    Hard to say without seeing the code or knowing what event it's in, but try adding

    DoEvents

    between the relevant sections.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Didn't help, sadly.

    The code is on a different server so can't copy and paste here, but in a nutshell this is what it does:

    Set dbs=OpenDatabase(database name)
    Set qdf=dbs.Querydefs(query name)
    Set rstOut=Currentdb.OpenRecordset(local table)

    For each fld in qdf.Fields
    write record to rstOut
    Next

    dbs.Close

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

Similar Threads

  1. Replies: 6
    Last Post: 04-03-2014, 02:02 PM
  2. count (*) timing out
    By aat in forum Queries
    Replies: 2
    Last Post: 12-14-2013, 06:04 AM
  3. Replies: 22
    Last Post: 05-21-2013, 07:54 PM
  4. Tab Issue
    By Lazor78 in forum Forms
    Replies: 3
    Last Post: 07-05-2012, 08:18 AM
  5. timing how long users are on each form
    By salej60 in forum Access
    Replies: 3
    Last Post: 06-07-2011, 08:20 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