Results 1 to 5 of 5

Thread: [RESOLVED] [Access 2003] DoCmd.OpenTable Processing Problem

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Location
    Best Place on Earth
    Posts
    363

    Resolved [RESOLVED] [Access 2003] DoCmd.OpenTable Processing Problem

    I need to be able to click a button on a form that will then open a table,
    and refrain from continuing the processing of the code until the user closes the
    table.

    The code I am using is as follows

    Code:
    Private Sub CmdProcessAIQ_Click()
    On Error GoTo Err_CmdProcessAIQ_Click
    
        DoCmd.OpenTable "AIQPaste", acViewNormal, acEdit
        MsgBox "This should only be processed when Table is closed."
        
    Exit_CmdProcessAIQ_Click:
        Exit Sub
    
    Err_CmdProcessAIQ_Click:
        MsgBox "Form_Main - CmdProcessAIQ_Click - " & Err.Number & vbCrLf & Err.Description
        Resume Exit_CmdProcessAIQ_Click
        
    End Sub
    I only want the code after the DoCmd.OpenTable to be processed when
    the table is closed.

    However as it stands at present the msgBox is appearing immediately after the table has been opened.

    How can I prevent this from happening, or set up code to be processed when
    the table is closed.
    Signature Under Construction

  2. #2
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: [Access 2003] DoCmd.OpenTable Processing Problem

    You cannot stop the code after DoCdm.OpenTable ... for editing
    unless adding a Do...Loop to test repeatedly but that is a very bad way.

    The easiest and good way is create a form for that table then open that form (with table view if you want) in Modale mode. The code will wait there until that form is closed or hidden.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Location
    Best Place on Earth
    Posts
    363

    Re: [Access 2003] DoCmd.OpenTable Processing Problem

    Hi anhn,

    Not sure how would work.

    Could you please advise on the steps needed.

    I am wanting to open the table, then paste in a load of data. could be
    several thousand rows of data, then when the table is closed I want to
    process the data in the table.
    Signature Under Construction

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [Access 2003] DoCmd.OpenTable Processing Problem

    The easiest method I think:

    Use two buttons - one for the open - one for the processing.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2006
    Location
    Best Place on Earth
    Posts
    363

    Re: [Access 2003] DoCmd.OpenTable Processing Problem

    I agree that using two buttons is the easiest, although I was hoping to avoid it if possible.
    Signature Under Construction

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width