473,396 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 FormMainRunReport_Click()
On Error GoTo Err_FormMainRunReport_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_ADD_SPEC2"
stDocName2 = "DeleteQry_AP_ADD_SPEC7"
stDocName3 = "DeleteQry_AP_APPARATUS"
stDocName4 = "DeleteQry_AP_CABINET_RACK"
stDocName5 = "DeleteQry_AP_CHANNEL"
stDocName6 = "DeleteQry_AP_CHANNEL_TYPE"
stDocName7 = "DeleteQry_AP_COMPONENT"
stDocName8 = "DeleteQry_AP_COMPONENT_SYS_IO_TYPE"
stDocName9 = "DeleteQry_AP_CONTROL_SYSTEM_TAG"
stDocName10 = "DeleteQry_AP_CONTROLLER"
stDocName11 = "DeleteQry_AP_DRAWING"
stDocName12 = "DeleteQry_AP_FLOW"
stDocName13 = "DeleteQry_AP_LEVEL_INSTRUMENT"
stDocName14 = "DeleteQry_AP_PANEL"
stDocName15 = "DeleteQry_AP_PANEL_STRIP"
stDocName16 = "DeleteQry_AP_PD_GENERAL"
stDocName17 = "DeleteQry_AP_RACK_POSITION"
stDocName18 = "DeleteQry_AP_SPEC_SHEET_DATA"
stDocName19 = "DeleteQry_AP_REVISION"
stDocName20 = "DeleteQry_AP_UDF_COMPONENT"
stDocName21 = "DeleteQry_AP_UDF_CS_TAG"
stDocName22 = "DeleteQry_tblInOutputTags"
stDocName23 = "DeleteQry_UDT_SUPPORT6"
stDocName24 = "AppendQry_ADD_SPEC2"
stDocName25 = "AppendQry_ADD_SPEC7"
stDocName26 = "AppendQry_APPARATUS"
stDocName27 = "AppendQry_CABINET_RACK"
stDocName28 = "AppendQry_CHANNEL"
stDocName29 = "AppendQry_CHANNEL_TYPE"
stDocName30 = "AppendQry_COMPONENT"
stDocName31 = "AppendQry_COMPONENT_SYS_IO_TYPE"
stDocName32 = "AppendQry_CONTROL_SYSTEM_TAG"
stDocName33 = "AppendQry_CONTROLLER"
stDocName34 = "AppendQry_DRAWING"
stDocName35 = "AppendQry_FLOW"
stDocName36 = "AppendQry_LEVEL_INSTRUMENT"
stDocName37 = "AppendQry_PANEL"
stDocName38 = "AppendQry_PANEL_STRIP"
stDocName39 = "AppendQry_PD_GENERAL"
stDocName40 = "AQryInputTag1"
stDocName41 = "AQryInputTag2"
stDocName42 = "AQryInputTag3"
stDocName43 = "AQryInputTag4"
stDocName44 = "AQryOutputTag1"
stDocName45 = "AQryOutputTag2"
stDocName46 = "AppendQry_RACK_POSITION"
stDocName47 = "AppendQry_SPEC_SHEET_DATA"
stDocName48 = "AppendQry_REVISION"
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.OpenReport stDocName52, acViewPreview
DoCmd.Close acForm, stDocName53, acSaveNo

DoCmd.Hourglass False

Exit_FormMainRunReport_Click:
Exit Sub

Err_FormMainRunReport_Click:
MsgBox Err.Description
Resume Exit_FormMainRunReport_Click

End Sub
Jun 27 '08 #1
3 1722
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
Jun 27 '08 #2
Wow Luke - glad you figured it out but you sure have a lot of memory
variables and processes running there.

Bonnie

http://www.dataplus-svc.com

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.com
http://www.accessmonster.com/Uwe/For...ccess/200806/1

Jun 27 '08 #3
lukethegooner <lu***********@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.Execute strSQL,dbfailonerror command instead of
docmd.runsql. For ADO use CurrentProject.Connection.Execute strCommand,
lngRecordsAffected, adCmdText

If you're going to use docmd.setwarnings 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.execute 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
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Barn Yard | last post by:
good morning, im still kind of new to VBA but I have learned some interesting things so far. Right now I am normalizing my survey database so I'm having to run an append query for each...
8
by: Bruce Dodds | last post by:
When run manually, my query appends 14 records. When run from code using CurrentProject.Connection.Execute, the same query appends 11 records. Does anyone have an explanation of why this could be...
1
by: Aaron | last post by:
Hello fellow programmers, I am trying to run an append/update query from code, a command button on a form initiates the queries. the format i am using is; ...
2
by: Greg Strong | last post by:
Hello All, I've written code in a test database with test data. Everything seems to be working except compact database in VB code per http://www.mvps.org/access/general/gen0041.htm. The reason I...
3
by: Dixie | last post by:
I know how to append records from one table to another in the same database, but I need to be able to append the records from all the tables in one database into new empty tables in another...
5
by: rdemyan via AccessMonster.com | last post by:
I have a table with about 80 fields. I'm using an import process to populate the table. It works fine, except for the following: Users generally don't specify values for a lot of numerical...
5
by: rdemyan via AccessMonster.com | last post by:
I have a need to add another field to all of my tables (over 150). Not data, but an actual field. Can I code this somehow. So the code presumabley would loop through all the tables, open each...
4
by: Rick | last post by:
Access2003 in XP I'm using the code below to append any new records from (tbl_From_Mainframe) into (tbl_Appended_Data). It takes more than a minute to search 7000 records for a dozen new records....
14
by: Supermansteel | last post by:
My team at work uses Cognos to run multiple queries to pull in data. Then they take that data and import into Access and then usually run an Append Query to run a RND function to pull out a few...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.