473,395 Members | 1,581 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,395 software developers and data experts.

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

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 5152
Killer42
8,435 Expert 8TB
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
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...
9
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...
0
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...
8
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...
12
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...
4
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...
3
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...
0
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...
5
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...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.