473,785 Members | 3,285 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Allowing Make Table Query overwriting existing table in mdb via adodb connection

1 New Member
Hi I am using the following code in a button click event to run a query stored in a .mdb file from an external geographic program ArcGIS via a jet adodb connection

I have the need to run an existing make table query, my problem is it will over write an existing table. i.e when run in access a warning that you are about to overwrite an existing table will be shown and you will be prompted to accept or reject. When run via the external program using the method below a run time error occurs saying the table to be overwriten already exists. I am unsure how to access the Accept reject overwrite function via the external program if it is possible at all. Any ideas on how to hand this error would be greatly appreciated

Expand|Select|Wrap|Line Numbers
  1. Dim strConnectionString As String
  2. Dim objConn As ADODB.Connection
  3. Dim objCommand As ADODB.Command
  4.  
  5. strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Database.mdb;" & _
  6. "Jet OLEDB:Engine Type=4"
  7.  
  8. Set objConn = New ADODB.Connection
  9. objConn.Open strConnectionString
  10.  
  11. Set objCommand = New ADODB.Command
  12.  
  13. objCommand.ActiveConnection = objConn
  14.  
  15. ' Assign to ADO Command object
  16. objCommand.CommandText = "QRY_ONE"
  17. objCommand.CommandType = adCmdStoredProc
  18.  
  19. objCommand.Execute
  20.  
  21. objConn.Close
  22.  
  23. Set objCommand = Nothing
  24. Set objConn = Nothing
  25.  
Thanks
Sep 28 '07 #1
1 5170
Killer42
8,435 Recognized Expert Expert
Why not just trap the "already exists" error, prompt the user, and if they say to go ahead, delete the existing table first? That's probably all that Access does.
Sep 28 '07 #2

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

Similar topics

1
1338
by: Vincent Jones | last post by:
I have this: <% Dim objConn, RS, strQ, strConnection Set objConn = Server.CreateObject("ADODB.Connection") strConnection = "DSN=Development;Database=PMA_Internet;" objConn.Open strConnection Set RS = Server.CreateObject("ADODB.Recordset")
9
11776
by: shank | last post by:
Per a previous suggestion, I'm trying to use a parametized query in Access 2002. The query functions properly in Access. Now I'm trying to call it from ASP. I'm using code I found at http://www.xefteri.com/articles/apr302002/default.aspx and trying to adjust for my needs. I'm getting this error. The query is there and functioning. It appears that I'm not connecting. Can I get some more insight? thanks! ------------------------------...
0
4492
by: ImraneA | last post by:
Hi there I had pleasure of upsizing Access v97 db to Access v2K/SQL 2K. Wish to provide some knowledge gained back to community - hopefully help others. 1.Question how do you test stored procedure from SQL Server vs MS Access point of view ?
8
6814
by: Roy Padgett | last post by:
I have a combo box where users select the customer name and can either go to the customer's info or open a list of the customer's orders. The RowSource for the combo box was a simple pass-through query: SELECT DISTINCT , , ,City, Region FROM Customers ORDER BY Customers.; This was working fine until a couple of weeks ago. Now whenever someone has the form open, this statement locks the entire Customers table.
12
34837
by: Bookreader | last post by:
I tried Googling this but I get a whole lot of replies about running the SQL statement in VB via ADO. All I want to do is run an existing ACCESS 2000 query from VB with no information returned to VB. I am presuming that I would use Automation somehow. Thanks in advance.
4
23909
by: Steven Smith | last post by:
Hello all, I have a vb6 (not .NET) program using MS Access as the backend. As part of an import form, I need to allow the user to select the table containing the data to be imported. How can I populate a combo with this information? Then, once this value is selected, how can I populate other combos with the column names of the selected table? Thanks,
3
2661
by: Bhavsan | last post by:
Here is what I am trying to do. Kindly, help me. 1. I'm creating a query dynamically based on User input using VBA (strSQL and DotSQL in the code below) 2. Executing the created query with in VBA 3. Writing to a table (tblRandom) the values from the recordset. -------------------------------- Private Sub append_record_Click() Dim strSQL As String Dim dotsql As String
0
1760
by: timber910 | last post by:
Ok, I have a button on a form that I'm using to create another table I will need later in my form. I have created a reference table called Ref_Table (holds my table names - using this as the tables with the orginal data changes from project to project), I have another reference table called Ref_Fields (this holds the fields I will need to pull out of the tables they are in.) I know there is a better way to code some of this so if you happen...
5
2114
by: timber910 | last post by:
I posted this in the VB forum but I think its in the wrong place. So I thought I would try here. _________________________________________ Ok, I have a button on a form that I'm using to create another table I will need later in my form. I have created a reference table called Ref_Table (holds my table names - using this as the tables with the orginal data changes from project to project), I have another reference table called Ref_Fields...
0
9480
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,...
1
10085
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
8968
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
7494
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
6737
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();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
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
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.