473,669 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Append and DELETE

58 New Member
Hello,
I have 2 DB that are linked (they are pretty much identical). I have an append sql statement. It works fine for most of it. I just have two questions.
1. When I started the DB I was not thinking and placed spaces into some of my table names. When I go to use the INPUT INTO statement, it gives me an error. Is there a way I can get it to work without having to change the table names? If I have to change them I will, I was just hoping there was a way I wouldnt have to. I have tried putting _ instead of spaces. Also have tried not saving it as a string 1st and just using
docmd.runsql Input Into "& "Surveilanc e room log1" & ...etc

2. After I append the table I then delete the info from the original table. I was just wondering if there is a way i can do it so that the program does not ask me if I want to Append and Delete. I move the data from about 8 tables to a master DB. So I have to hit OK about 16 times before its finished.

Expand|Select|Wrap|Line Numbers
  1.             strAppend1 = "INSERT INTO Surveilance Room log1 SELECT * FROM Surveilance Room log"
  2.             DoCmd.RunSQL strAppend1
  3.             strAppend1 = "Delete * from Surveilance Room log"
  4.             DoCmd.RunSQL strAppend1
  5.  
surveilance room log1 is on the master DB, surveilance room log is the temp DB

Andrew
Oct 30 '07 #1
3 2173
ADezii
8,834 Recognized Expert Expert
Hello,
I have 2 DB that are linked (they are pretty much identical). I have an append sql statement. It works fine for most of it. I just have two questions.
1. When I started the DB I was not thinking and placed spaces into some of my table names. When I go to use the INPUT INTO statement, it gives me an error. Is there a way I can get it to work without having to change the table names? If I have to change them I will, I was just hoping there was a way I wouldnt have to. I have tried putting _ instead of spaces. Also have tried not saving it as a string 1st and just using
docmd.runsql Input Into "& "Surveilanc e room log1" & ...etc

2. After I append the table I then delete the info from the original table. I was just wondering if there is a way i can do it so that the program does not ask me if I want to Append and Delete. I move the data from about 8 tables to a master DB. So I have to hit OK about 16 times before its finished.

Expand|Select|Wrap|Line Numbers
  1.             strAppend1 = "INSERT INTO Surveilance Room log1 SELECT * FROM Surveilance Room log"
  2.             DoCmd.RunSQL strAppend1
  3.             strAppend1 = "Delete * from Surveilance Room log"
  4.             DoCmd.RunSQL strAppend1
  5.  
surveilance room log1 is on the master DB, surveilance room log is the temp DB

Andrew
Expand|Select|Wrap|Line Numbers
  1. 'Place Brackets ([ ]) around Table and/or Field Names containing spaces
  2. strAppend1 = "INSERT INTO [Surveilance Room log1] SELECT * FROM [Surveilance Room log]"
  3.  
  4. 'Use the SetWarnings Method to turn ON/OFF display of system messages in Visual Basic
  5. DoCmd.SetWarnings False
  6.   DoCmd.RunSQL strAppend1
  7.     strAppend1 = "Delete * from Surveilance Room log"
  8.   DoCmd.RunSQL strAppend1
  9. DoCmd.Setwarnings True              'Reset to display
  10.  
Oct 30 '07 #2
rudeman76
58 New Member
Thank you so much. It works awesome.

Andrew
Oct 30 '07 #3
ADezii
8,834 Recognized Expert Expert
Thank you so much. It works awesome.

Andrew
You are quite welcome, Andrew.
Oct 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

19
11283
by: John Keeling | last post by:
Dear all, I tried the test program below. My interest is to examine timing differences between insert vs. append & reverse for a list. My results on my XP Python 2.3.4 are as follows: time_reverse 0.889999389648 time_insert 15.7750005722 Over multiple runs ... the time taken to insert at the head of a list, vs. the time taken to append to a list and then reverse it is typically 16 or 17 times longer. I would have expected the insert...
1
3477
by: Greg | last post by:
I run some reports from the web that is connected to an Access database. I run a macro every 25 minutes that deletes the tables and then appends data to the tables with fresh data. The issue I have is that between the delete and append there is a 4 minute window when reports cannot be generated since the tables are empty due to the delete query. Is there method to replace the table with data without having the down time during the delete...
9
4500
by: JMCN | last post by:
hi- i have inherited an access 97 database that keeps track of the loans. i have been running into referential intergrity problems when i try to append new loans to table. first of all is a linked table from another ms database. when i try to run the append query, i receive an error message that it cannot append all the records due to key violations to the . so i looked at all of the relationships and
3
1743
by: Cc | last post by:
how do i delete last append line?
4
7384
by: MN | last post by:
I have to import a tab-delimited text file daily into Access through a macro. All of the data needs to be added to an existing table. Some of the data already exists but may be updated by the imported text file. I can update the data through an update query or append the entire import table through an append query. Is there a way to combine the two so that I can update existing records and append only new records (without duplicating...
1
1838
by: kamle_b | last post by:
I know it is best said to archive records when you press delete button. I need help with this. I have a list box where filtered data is showed. The user highlights the record and clicks on delete button to delete the record. This at the minute completely takes off that record. How do i back-up this data so that on clicking delete button it will remove the record from list box but append to other table called tblBackup? I have tried making...
10
2043
by: pythonnoob | last post by:
Hello everyone. New to python as well as this forum, but i must say ive learned a but already reading through some posts. Seems to be a pretty helpful community here. Before i post a question ill give you a little background. I have done programming in the past in Basic, VB, and a little C. I am not much of a programmer, its more of a hobby/curiosity. The following code is not mine, i am trying to modify a template of a mock database....
4
3371
by: Scott12345 | last post by:
Hi, here is my situation, I have a DB that tracks machine downtime (30 machines) per day. Several users will update this through the day. I created an append query that creates 30 dummy values and then opens up a form that displays all 30 values. The user can then go through these and change the ones they are responsible for. After they have updated this form, i have a delete query that searches for the dummy values and removes them. My...
8
3169
jinalpatel
by: jinalpatel | last post by:
I have two tables. tblClass and tblWithdrawn. On my main form(bound to tblClass) I have several data entry fields like Date withdrawn, Status (active or withdrawn) Date Classified etc. Also there is one command button called cmdAppendDelete. On click this command button two queries are run .(append and delete) When user selects Status = Withdrawn and enter the "Date Withdrawn", he has to click on this command button. Append query...
0
8465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8383
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8894
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8803
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8587
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7407
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6210
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.