Code Doesn't Run some Append Queries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lukethegooner

    Code Doesn't Run some Append Queries

    I can't see the wood for the tree's here, I have some code set up to
    run through a bunch of delete queries, re-append fresh information to
    local DB tables then run a report. But in the code below the Append
    queires (stDocName40 thru' stDocName45) don't run (info does not
    append to the table) when I execute the code.

    I don't see why it doesn't work and I'm confused. Any ideas? I've
    checked, double checked and triple checked for any typo's, maybe I'm
    missing something here ...? When I double click the Append Q's in the
    database they work fine / as intended.

    *********

    Private Sub FormMainRunRepo rt_Click()
    On Error GoTo Err_FormMainRun Report_Click

    DoCmd.Hourglass True

    Dim stDocName1 As String
    Dim stDocName2 As String
    Dim stDocName3 As String
    Dim stDocName4 As String
    Dim stDocName5 As String
    Dim stDocName6 As String
    Dim stDocName7 As String
    Dim stDocName8 As String
    Dim stDocName9 As String
    Dim stDocName10 As String
    Dim stDocName11 As String
    Dim stDocName12 As String
    Dim stDocName13 As String
    Dim stDocName14 As String
    Dim stDocName15 As String
    Dim stDocName16 As String
    Dim stDocName17 As String
    Dim stDocName18 As String
    Dim stDocName19 As String
    Dim stDocName20 As String
    Dim stDocName21 As String
    Dim stDocName22 As String
    Dim stDocName23 As String
    Dim stDocName24 As String
    Dim stDocName25 As String
    Dim stDocName26 As String
    Dim stDocName27 As String
    Dim stDocName28 As String
    Dim stDocName29 As String
    Dim stDocName30 As String
    Dim stDocName31 As String
    Dim stDocName32 As String
    Dim stDocName33 As String
    Dim stDocName34 As String
    Dim stDocName35 As String
    Dim stDocName36 As String
    Dim stDocName37 As String
    Dim stDocName38 As String
    Dim stDocName39 As String
    Dim stDocName40 As String
    Dim stDocName41 As String
    Dim stDocName42 As String
    Dim stDocName43 As String
    Dim stDocName44 As String
    Dim stDocName45 As String
    Dim stDocName46 As String
    Dim stDocName47 As String
    Dim stDocName48 As String
    Dim stDocName49 As String
    Dim stDocName50 As String
    Dim stDocName51 As String
    Dim stDocName52 As String
    Dim stDocName53 As String

    stDocName1 = "DeleteQry_AP_A DD_SPEC2"
    stDocName2 = "DeleteQry_AP_A DD_SPEC7"
    stDocName3 = "DeleteQry_AP_A PPARATUS"
    stDocName4 = "DeleteQry_AP_C ABINET_RACK"
    stDocName5 = "DeleteQry_AP_C HANNEL"
    stDocName6 = "DeleteQry_AP_C HANNEL_TYPE"
    stDocName7 = "DeleteQry_AP_C OMPONENT"
    stDocName8 = "DeleteQry_AP_C OMPONENT_SYS_IO _TYPE"
    stDocName9 = "DeleteQry_AP_C ONTROL_SYSTEM_T AG"
    stDocName10 = "DeleteQry_AP_C ONTROLLER"
    stDocName11 = "DeleteQry_AP_D RAWING"
    stDocName12 = "DeleteQry_AP_F LOW"
    stDocName13 = "DeleteQry_AP_L EVEL_INSTRUMENT "
    stDocName14 = "DeleteQry_AP_P ANEL"
    stDocName15 = "DeleteQry_AP_P ANEL_STRIP"
    stDocName16 = "DeleteQry_AP_P D_GENERAL"
    stDocName17 = "DeleteQry_AP_R ACK_POSITION"
    stDocName18 = "DeleteQry_AP_S PEC_SHEET_DATA"
    stDocName19 = "DeleteQry_AP_R EVISION"
    stDocName20 = "DeleteQry_AP_U DF_COMPONENT"
    stDocName21 = "DeleteQry_AP_U DF_CS_TAG"
    stDocName22 = "DeleteQry_tblI nOutputTags"
    stDocName23 = "DeleteQry_UDT_ SUPPORT6"
    stDocName24 = "AppendQry_ADD_ SPEC2"
    stDocName25 = "AppendQry_ADD_ SPEC7"
    stDocName26 = "AppendQry_APPA RATUS"
    stDocName27 = "AppendQry_CABI NET_RACK"
    stDocName28 = "AppendQry_CHAN NEL"
    stDocName29 = "AppendQry_CHAN NEL_TYPE"
    stDocName30 = "AppendQry_COMP ONENT"
    stDocName31 = "AppendQry_COMP ONENT_SYS_IO_TY PE"
    stDocName32 = "AppendQry_CONT ROL_SYSTEM_TAG"
    stDocName33 = "AppendQry_CONT ROLLER"
    stDocName34 = "AppendQry_DRAW ING"
    stDocName35 = "AppendQry_FLOW "
    stDocName36 = "AppendQry_LEVE L_INSTRUMENT"
    stDocName37 = "AppendQry_PANE L"
    stDocName38 = "AppendQry_PANE L_STRIP"
    stDocName39 = "AppendQry_PD_G ENERAL"
    stDocName40 = "AQryInputT ag1"
    stDocName41 = "AQryInputT ag2"
    stDocName42 = "AQryInputT ag3"
    stDocName43 = "AQryInputT ag4"
    stDocName44 = "AQryOutputTag1 "
    stDocName45 = "AQryOutputTag2 "
    stDocName46 = "AppendQry_RACK _POSITION"
    stDocName47 = "AppendQry_SPEC _SHEET_DATA"
    stDocName48 = "AppendQry_REVI SION"
    stDocName49 = "AppendQry_UDF_ COMPONENT"
    stDocName50 = "AppendQry_UDF_ CS_TAG"
    stDocName51 = "AppendQry_UDT_ SUPPORT6"
    stDocName52 = "QryDCSCIOA "
    stDocName53 = "FormMain"

    DoCmd.OpenQuery stDocName1, acViewNormal
    DoCmd.OpenQuery stDocName2, acViewNormal
    DoCmd.OpenQuery stDocName3, acViewNormal
    DoCmd.OpenQuery stDocName4, acViewNormal
    DoCmd.OpenQuery stDocName5, acViewNormal
    DoCmd.OpenQuery stDocName6, acViewNormal
    DoCmd.OpenQuery stDocName7, acViewNormal
    DoCmd.OpenQuery stDocName8, acViewNormal
    DoCmd.OpenQuery stDocName9, acViewNormal
    DoCmd.OpenQuery stDocName10, acViewNormal
    DoCmd.OpenQuery stDocName11, acViewNormal
    DoCmd.OpenQuery stDocName12, acViewNormal
    DoCmd.OpenQuery stDocName13, acViewNormal
    DoCmd.OpenQuery stDocName14, acViewNormal
    DoCmd.OpenQuery stDocName15, acViewNormal
    DoCmd.OpenQuery stDocName16, acViewNormal
    DoCmd.OpenQuery stDocName17, acViewNormal
    DoCmd.OpenQuery stDocName18, acViewNormal
    DoCmd.OpenQuery stDocName19, acViewNormal
    DoCmd.OpenQuery stDocName20, acViewNormal
    DoCmd.OpenQuery stDocName21, acViewNormal
    DoCmd.OpenQuery stDocName22, acViewNormal
    DoCmd.OpenQuery stDocName23, acViewNormal
    DoCmd.OpenQuery stDocName24, acViewNormal
    DoCmd.OpenQuery stDocName25, acViewNormal
    DoCmd.OpenQuery stDocName26, acViewNormal
    DoCmd.OpenQuery stDocName27, acViewNormal
    DoCmd.OpenQuery stDocName28, acViewNormal
    DoCmd.OpenQuery stDocName29, acViewNormal
    DoCmd.OpenQuery stDocName30, acViewNormal
    DoCmd.OpenQuery stDocName31, acViewNormal
    DoCmd.OpenQuery stDocName32, acViewNormal
    DoCmd.OpenQuery stDocName33, acViewNormal
    DoCmd.OpenQuery stDocName34, acViewNormal
    DoCmd.OpenQuery stDocName35, acViewNormal
    DoCmd.OpenQuery stDocName36, acViewNormal
    DoCmd.OpenQuery stDocName37, acViewNormal
    DoCmd.OpenQuery stDocName38, acViewNormal
    DoCmd.OpenQuery stDocName39, acViewNormal
    DoCmd.OpenQuery stDocName40, acViewNormal
    DoCmd.OpenQuery stDocName41, acViewNormal
    DoCmd.OpenQuery stDocName42, acViewNormal
    DoCmd.OpenQuery stDocName43, acViewNormal
    DoCmd.OpenQuery stDocName44, acViewNormal
    DoCmd.OpenQuery stDocName45, acViewNormal
    DoCmd.OpenQuery stDocName46, acViewNormal
    DoCmd.OpenQuery stDocName47, acViewNormal
    DoCmd.OpenQuery stDocName48, acViewNormal
    DoCmd.OpenQuery stDocName49, acViewNormal
    DoCmd.OpenQuery stDocName50, acViewNormal
    DoCmd.OpenQuery stDocName51, acViewNormal
    DoCmd.OpenRepor t stDocName52, acViewPreview
    DoCmd.Close acForm, stDocName53, acSaveNo

    DoCmd.Hourglass False

    Exit_FormMainRu nReport_Click:
    Exit Sub

    Err_FormMainRun Report_Click:
    MsgBox Err.Description
    Resume Exit_FormMainRu nReport_Click

    End Sub
  • lukethegooner

    #2
    Re: Code Doesn't Run some Append Queries

    On 19 Jun, 13:31, lukethegooner <lukethegoo...@ gmail.comwrote:
    I don't see why it doesn't work and I'm confused. Any ideas? I've
    checked, double checked and triple checked for any typo's, maybe I'm
    missing something here ...? When I double click the Append Q's in the
    database they work fine / as intended.
    Sorry ignore this I've just figured it out, GUI** as usual **(Gross
    User Incompetence)

    The tables the Append's were set to drag data from are set to update
    *AFTER* I've run the intended appends... so there was nothing to
    append!! Hahahaha!

    D'OH !!!

    Luke

    Comment

    • bhicks11 via AccessMonster.com

      #3
      Re: Code Doesn't Run some Append Queries

      Wow Luke - glad you figured it out but you sure have a lot of memory
      variables and processes running there.

      Bonnie

      Data entry services, data entry and database programming services since 1992. Security, accuracy, and reasonable pricing. (678) 773-6504


      lukethegooner wrote:
      >I don't see why it doesn't work and I'm confused. Any ideas? I've
      >checked, double checked and triple checked for any typo's, maybe I'm
      >missing something here ...? When I double click the Append Q's in the
      >database they work fine / as intended.
      >
      >Sorry ignore this I've just figured it out, GUI** as usual **(Gross
      >User Incompetence)
      >
      >The tables the Append's were set to drag data from are set to update
      >*AFTER* I've run the intended appends... so there was nothing to
      >append!! Hahahaha!
      >
      >D'OH !!!
      >
      >Luke
      --
      Message posted via AccessMonster.c om


      Comment

      • Tony Toews [MVP]

        #4
        Re: Code Doesn't Run some Append Queries

        lukethegooner <lukethegooner@ gmail.comwrote:
        >I don't see why it doesn't work and I'm confused. Any ideas?
        You already have solved your immediate problem. However docmd.runquery won't give
        you any, or rather userful, error messages.

        I prefer, if DAO, to use Currentdb.Execu te strSQL,dbfailon error command instead of
        docmd.runsql. For ADO use CurrentProject. Connection.Exec ute strCommand,
        lngRecordsAffec ted, adCmdText

        If you're going to use docmd.setwarnin gs make very sure you put the True statement in
        any error handling code as well. Otherwise weird things may happen later on
        especially while you are working on the app. For example you will no longer get the
        "Do you wish to save your changes" message if you close an object. This may mean
        that unwanted changes, deletions or additions will be saved to your MDB.

        Also performance can be significantly different between the two methods. One posting
        stated currentdb.execu te took two seconds while docmd.runsql took eight seconds. As
        always YMMV.

        Tony
        --
        Tony Toews, Microsoft Access MVP
        Please respond only in the newsgroups so that others can
        read the entire thread of messages.
        Microsoft Access Links, Hints, Tips & Accounting Systems at

        Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

        Comment

        Working...