473,624 Members | 2,288 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Runtime Error 3010...table Already Exists

98 New Member
Can anyone help me figure out why I continue to get a runtime error '3010' "TABLE qryMultiSelect ALREADY EXISTS'? Here is my code. thank you in advance for any help!!!

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmbSelectionDone_Click()
  2.     Dim db As DAO.Database
  3.     Dim qdf As DAO.QueryDef
  4.     Dim varItem As Variant
  5.     Dim strCriteria As String
  6.     Dim strSQL As String
  7.  
  8.     Set db = CurrentDb()
  9.     Set qdf = db.QueryDefs("qryMultiSelect")
  10.     If Me!cboxRangeName = -1 Then
  11.         myPath = txtFilePath & txtFileName
  12.         myFileName = Me!txtFileName
  13.         DoCmd.SetWarnings (False)
  14.         DoCmd.RunSQL "DELETE * FROM TempSymbol"
  15.         DoCmd.SetWarnings (True)
  16.         DoCmd.TransferSpreadsheet acImport, , "TempSymbol", "" & myPath & "", True, "" & txtRangeName & ""
  17.         MsgBox "The symbols have been successfully imported."
  18.         strSQL = "SELECT DailyPrice.Symbol, DailyPrice.LocateDate, DailyPrice.MarketPrice, DailyPrice.PriceFlag " & _
  19.                 "FROM TempSymbol, DailyPrice " & _
  20.                 "WHERE (((DailyPrice.Symbol) = [TempSymbol]![Symbol])) " & _
  21.                 "ORDER BY DailyPrice.Symbol, DailyPrice.LocateDate;"
  22.         qdf.SQL = strSQL
  23.         'check this out...maybe delete it later
  24.         qdf.Close
  25.         DoCmd.TransferSpreadsheet acExport, , "qryMultiSelect", "" & myPath & ""
  26.         MsgBox "The table have been successfully exported to " & myFileName & "."
  27.         Set db = Nothing
  28.         Set qdf = Nothing
  29.         Exit Sub
  30.     End If
  31.         'DoCmd.TransferSpreadsheet acExport, , "qryMultiSelect", "" & myPath & ""
  32.  
  33.     If IsNull(txtGetList) Then
  34.         For Each varItem In Me!lstSelectSymbol.ItemsSelected
  35.             strCriteria = strCriteria & "'" & Me!lstSelectSymbol.ItemData(varItem) & "',"
  36.         Next varItem
  37.  
  38.         If Len(strCriteria) = 0 Then
  39.             MsgBox "You did not select anything from the list", vbExclamation, "Nothing to find!"
  40.             Set db = Nothing
  41.             Set qdf = Nothing
  42.             Me!lstSelectSymbol.SetFocus
  43.             Exit Sub
  44.         End If
  45.  
  46.         strCriteria = Left(strCriteria, Len(strCriteria) - 1)
  47.         myPath = txtFilePath & txtFileName
  48.         myFileName = Me!txtFileName
  49.  
  50.         strSQL = "SELECT DailyPrice.Symbol, DailyPrice.LocateDate, DailyPrice.MarketPrice, DailyPrice.PriceFlag FROM DailyPrice " & _
  51.                  "WHERE DailyPrice.Symbol IN (" & strCriteria & ") " & _
  52.                  "ORDER BY DailyPrice.Symbol, DailyPrice.LocateDate;"
  53.  
  54.             qdf.SQL = strSQL
  55.             DoCmd.TransferSpreadsheet acExport, , "qryMultiSelect", "" & myPath & ""
  56.             MsgBox "The table have been successfully exported to " & myFileName & "."
  57.             qdf.Close
  58.             Set db = Nothing
  59.             Set qdf = Nothing
  60.             Exit Sub
  61.     End If
  62.     strCriteria = Me!txtGetList
  63.     myPath = txtFilePath & txtFileName
  64.     myFileName = Me!txtFileName
  65.  
  66.    ' On Error GoTo Do_Nothing
  67.  
  68.     strSQL = "SELECT DailyPrice.Symbol, DailyPrice.LocateDate, DailyPrice.MarketPrice, DailyPrice.PriceFlag FROM DailyPrice " & _
  69.                  "WHERE DailyPrice.Symbol IN (" & strCriteria & ") " & _
  70.                  "ORDER BY DailyPrice.Symbol, DailyPrice.LocateDate;"
  71.  
  72.     qdf.SQL = strSQL
  73.     DoCmd.OpenQuery "qryMultiSelect"
  74.     DoCmd.TransferSpreadsheet acExport, , "qryMultiSelect", "" & myPath & ""
  75.     MsgBox "The table have been successfully exported to " & myFileName & "."
  76.     qdf.Close
  77.     Set db = Nothing
  78.     Set qdf = Nothing
  79.  
  80. End Sub
Oct 23 '06 #1
10 21461
MMcCarthy
14,534 Recognized Expert Moderator MVP
What line exactly is the code stopping at?
Oct 23 '06 #2
ineedahelp
98 New Member
The error is occuring at the first instance of:

DoCmd.TransferS preadsheet acExport, , "qryMultiSelect ", "" & myPath & ""
Oct 23 '06 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
The error is occuring at the first instance of:

DoCmd.TransferS preadsheet acExport, , "qryMultiSelect ", "" & myPath & ""
Where are you exporting to?
Are you sending to another database?
Oct 23 '06 #4
ineedahelp
98 New Member
I am exporting to excel.
Oct 24 '06 #5
MMcCarthy
14,534 Recognized Expert Moderator MVP
Although Access says Table already exists, it may be talking about the excel spreadsheet. If this is on a network you may be having problems overwriting it.

To test this theory

Change the path each time ( small change to the name would be enourgh) and see if you still get the error
Oct 24 '06 #6
NeoPa
32,567 Recognized Expert Moderator MVP
Good idea.

I make it a policy always to attempt deletion of any resulting file before writing it, using On Error & all that stuff where required. That way I can see if it's a file problem rather than code, and also I can re-run the code as many times as I need without worrying that it will only work the first time.
Oct 24 '06 #7
Universalmon
1 New Member
Funny - I researched the help file because at my company I wrote a bunch of code and ran into the same thing. That damn exportspreadshe et, or TransferSpreads heet commands - or actually the one I amworking with, TransferText - all say that if the file exists it will over-write the file. NOT TRUE! If the file exists, you get a trappable error.

My solution is if you get the error, trap for the bitch on a if Err.Number = 3010 then **** delete the fuc**ng file using 'Kill <path>' ****. HELP FILE IS WRONG - those command do NOT OVER-WRITE FILE IF IF EXISTS. They get an error.

Cheers.
Apr 16 '07 #8
Denburt
1,356 Recognized Expert Top Contributor
O.K. First she asked which line of code and you posted a line of code that is used three or more times in your routine.

I did notice this in your first if statement you appear to have as so and it looks fine:
Expand|Select|Wrap|Line Numbers
  1. qdf.SQL = strSQL
  2. 'check this out...maybe delete it later
  3. qdf.Close
  4. DoCmd.TransferSpreadsheet acExport, , "qryMultiSelect", "" & myPath & ""
  5.  
Then the following statements have it a little different which could and is probably why you are having this issue. I Transfer export spreadsheets and HTML all day long and it always overwrites the older one with no issues.
Expand|Select|Wrap|Line Numbers
  1.  
  2. qdf.SQL = strSQL
  3. DoCmd.TransferSpreadsheet acExport, , "qryMultiSelect", "" & myPath & ""
  4. MsgBox "The table have been successfully exported to " & myFileName & "."
  5. qdf.Close
  6.  
I would close that QDF before you try to transfer it or you will not get the results you are looking for since the new qdf has not been completed.
Apr 16 '07 #9
dberkheimer
1 New Member
Since the original post is three years old, I'm going to go out on a limb and guess that he/she has moved on. Then again, they may work for the government...

Anyway, hopefully this will help somebody: The most likely explanation is that the output spreadsheet is open. If so, the easy fix is to simply close the spreadhseet, and re-run the code. If it's not such an obvious problem, it's probably similar; perhaps the sheet is in a read-only state for some reason, such as network permissions, e.g.
Sep 8 '09 #10

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

Similar topics

3
13298
by: Rahul Bakshi | last post by:
Hi I am getting this error which is frustrating me a lot Microsoft VBScript runtime error '800a01c9' This key is already associated with an element of this collection /process.asp, line 362
1
6179
by: Neo | last post by:
Hi, I have dumped a database into the file named dbase.sql when I am trying to recreate the database its giving the following error. can any one help me in this regard? # vim dbase.sql # mysql -u "root" project < dbase.sql ERROR 1050 at line 19: Table 'columns_priv' already exists Vasundhar/
14
10124
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought I should give back to the community by posting our findings. Thanks you all for all your help till now by posting problems and their solutions. ~Abhijit
3
4300
by: RBohannon | last post by:
I've developed a database in Access 2000 on Windows 2000. I have been asked to put the database on a machine running Windows XP. I copied the database onto the XP machine with some data already in it. Everything seemed to be working correctly, until I tried to import new data. New data is imported into the database from a floppy disk. To prevent duplicate entries, I have a boolean function called Exists which uses the Seek method of...
0
4341
by: tony dong | last post by:
Hi there I use vs.net 2005 with standard sql 2005 under machine\sql2005 for instant when I create webpart, the code get from quickstart as follow: <%@ Page Language="C#" %> <%@ Register Src="WebPartPageMenu.ascx" TagName="WebPartPageMenu" TagPrefix="uc1" %> <html> <head id="Head1" runat="server"> <title>Web Part Page</title>
1
10145
by: delusion7 | last post by:
Trying to create a table and insert records from a webform and I keep getting this message: "Successfully created the registration table. Unable to execute the query. Error code 1050: Table 'registration' already exists" Then after the table is created I re-run the query/webform and I don't receive the error message, but it doesn't update my table? When I go to mySQL it shows the table 'registration' but has no updated...
8
13094
by: g_man | last post by:
I am trying trap Runtime error 3022 (duplicates) in the click event of a command button that closes the form. I have code in the Form_Error event that does a good job of providing a more meaningful error message than the default. It works in every situation except when the user clicks the close button. I am using Me.Dirty=False to force a save but if there are duplicates I just get the standard Runtime 3022 error message. I am wondering...
6
3447
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am using MS-Access 2000 database table for this app. Note that the datatype of all the fields mentioned above are Text. Apart from the above columns, there's another column in the DB table named 'RegDateTime' whose datatype is Date/Time which is...
15
3880
towsie
by: towsie | last post by:
Hi, I am having a problem with code below, I am getting a runtime error 424: Object Required. The section of code in bold is where the error occurs. Any help would be greatly appreciated.
0
8175
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
8680
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...
1
8336
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
8482
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
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
4082
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...
1
2610
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
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.