473,396 Members | 1,895 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.

Why do I get errors while linking ?

26
I am repeatedly getting errors , while trying to link tables in a local database at the below code

If TableExists(CurrentDb.Name, "tblBC") Then DoCmd.DeleteObject acTable, "tblBC"


DoCmd.TransferDatabase acLink, "Microsoft Access", sNormalisedDatabasePath, acTable, "tblBC", "tblBC" ----getting error in this line

The database was built in Access 2003 but now I am trying to run it in Access 2007.

The value of the normalised database is :---
?sNormalisedDatabasePath
C:\Documents and Settings\All Users\Documents\GIR_BE.mdb


The error message which I get doesn't have any error description.From the line which throws the error as shown above,the control moves to the UserLog subroutine , it writes down the status and then mssgbox err.description , which doesn't show any error description.And then there is the Resume statement and it keeps repeating.

I have no clue , why am I getting this error.
GIR_BE.mdb is at C:\Documents and Settings\All Users\Documents\

DoCmd.TransferDatabase acLink, "Microsoft Access", sNormalisedDatabasePath, acTable, "tblBC", "tblBC" (ERROR IN THIS LINE)


acLink--(not supported for .adp databases)..Can this be a reason ??But GIR_BE.mdb

is a .mdb




Thanks
Titli
Feb 15 '11 #1
6 2362
ADezii
8,834 Expert 8TB
Need to see the Code behind TableExists(). As an alternative approach:
Expand|Select|Wrap|Line Numbers
  1. Dim tdf As DAO.TableDef
  2.  
  3. For Each tdf In CurrentDb.TableDefs
  4.   If tdf.name = "tblBC" Then
  5.     CurrentDb.TableDefs.Delete "tblBC"
  6.       Exit For
  7.   End If
  8. Next
Feb 15 '11 #2
Lysander
344 Expert 100+
I have a routine that drops all links to attached tables, then re-creates them for a database on another hard drive. If this routine fails, or I repeat it quickly twice in succession, I get a shed load of errors relating to tables with wierd tmp names. I think when you delete an object in access, it does not get deleted instantly, there seems to be a temp object created, which deletes later.

After your docmd.deleteobject, try putting a DoEvents which will allow Access to catch up and finish the delete before the import starts.
Feb 15 '11 #3
titli
26
TableExists Code

Private Function TableExists(sAccessPath As String, sTable As String) As Boolean

Dim db As DAO.Database
Dim tdf As DAO.TableDef
Set db = OpenDatabase(sAccessPath)

For Each tdf In db.TableDefs

If tdf.Name = sTable Then
TableExists = True
Exit Function
End If

Next

TableExists = False

End Function
---------------------------------------------------------
sAccessPath - C:\Documents And Settings\All Users\
sTable - tblBC

Have printed sTable and tdf.Name
and match was not found.So TableExists remained False

And the deletion part of the code did not execute at all.
Then comes ' DoCmd.TransferDatabase acLink ' command which throws error

This is the case when i run in 2007.
-------------------------------------------------------------------------
*******Complete separate problem when run in 2003 ******

MDB is actually a 2003 one.

Whereas in 2003 the problem is completely different , the application fails at the first step with an error , The file at 'some path ' is opened by another user !The file must be closed before dat acan be imported.Find teh user and try again in 5 mins.

But the file is not opened by anyone.

It fails after we Determine what type of transfer we need to perform ------
Select Case m_ImportDetails.m_TransferType

and transfer type was TransferText ------
Case 5 'TransferText
.TransferText m_ImportDetails.m_TransferType, m_ImportDetails.m_SpecName, m_ImportDetails.m_LocalTableName, _
m_ImportDetails.m_FilePath, m_ImportDetails.m_FieldNames
(all of these have values)

after that it moves to error handler-----
Case 3051
MsgBox "The file: " & vbCrLf & m_ImportDetails.m_FilePath & " is open by another user!" & Chr(13) _
& vbCrLf & "This file must be closed before data can be imported. Find the user or try again in 5 minutes.", vbCritical, "Data not Imported!"
GoTo Exit_fLinkFile:

I am not able to open the file in the path mentioned above(some path).It says either teh file is read-only or encrypted.(.csv file , 13, 711 KB)

But why is someone else able to run the application in their system ?

I read this somewhere :--
There can be a variety of causes for 3051 errors when creating .csv files. They seem to include these points , how do i check if the reason is point 3 below?

-Insufficient permissions on the folder where the file is being created
-A non-standard file extension (if you're using something other than
.txt or .csv, try changing it)
-The file already exists and has been locked by another process (or, in
one case i saw, by your own application)
-Maybe, the file is read-only.



Thanks for your replies , would be grateful if you can spend some more time , telling me what could be the reason of the error and a probabale solution would be of great help !!
Feb 16 '11 #4
ADezii
8,834 Expert 8TB
Expand|Select|Wrap|Line Numbers
  1. Const conDB_PATH As String = "C:\Test\Test.mdb"
  2. Const conTABLE_NAME As String = "tblTest"
  3.  
  4.  
  5. If TableExists(conDB_PATH, conTABLE_NAME) Then DoCmd.DeleteObject acTable, conTABLE_NAME
  6.  
  7. DoCmd.TransferDatabase acLink, "Microsoft Access", conDB_PATH, acTable, _
  8.                        conTABLE_NAME, conTABLE_NAME, False
Expand|Select|Wrap|Line Numbers
  1. Public Function TableExists(sAccessPath As String, sTable As String) As Boolean
  2. Dim tdf As DAO.TableDef
  3.  
  4. For Each tdf In CurrentDb.TableDefs
  5.   If tdf.name = sTable Then
  6.     TableExists = True
  7.       Exit Function
  8.   End If
  9. Next
  10.  
  11. TableExists = False
  12. End Function
Feb 16 '11 #5
Lysander
344 Expert 100+
Your Access 2003 error message might be a clue.

In your tableexists function you have the line

Set db = OpenDatabase(sAccessPath)

but you never close the database or set db=nothing.

ADezii's function above does not do an open on the database and could fix the problem.
Feb 16 '11 #6
titli
26
Why am I able to open ceratin .csv files in Excel 2007 and and use the files for running an 2007 MS access application , whereas not able to open same .csv in Excel 2003 and not able to use the files for the MS Access application (access 2007 ) ? ---- I need help !! Please.I have to run it 2003.And it's kind of very urgent.
Feb 17 '11 #7

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

Similar topics

0
by: Joonas Paalasmaa | last post by:
Hi, When compiling Sketch's streamfilter C extension the errors below are raised during linking. What could cause the errors? (Python 2.3, MinGw 1.1 with GCC 2.95.3-6, Windows 98) Here are...
3
by: rama | last post by:
HI, I have a win32 application that works okay but when i use the same classes in a MFC application , i am faced with problems. I am including a library into the MFC applicationand compilation...
0
by: SM | last post by:
Hi, While linking orbix C++ application, we get a lot of linking errors. Few errors are pasted below. If someone could tell us which are the libraries that need to be added, it would be of help....
7
by: Steven T. Hatton | last post by:
Is there anything that gives a good description of how source code is converted into a translation unit, then object code, and then linked. I'm particularly interested in understanding why putting...
0
by: Chris | last post by:
Hi I have a project that was written in V6.0 (c/c++) and it works just fine, but when I run it in .NET 2003 (V7.0), I get a whole lot of linking errors. I have spent alot of time trying to...
1
by: Maxwell | last post by:
Hello, I having having oodles of trouble using the std lib in my MC++ (VS.NET 2003) Class library. I figured out a simple sample to reproduce the errors I am having. Create a MC++ (VS.NET 2003)...
3
by: walkeraj | last post by:
I'm trying to compile an open source game called IVAN , and I'm able to compile it from a makefile, but not from an IDE. I have attempted to recreate the way the makefile compiles the project as...
1
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
2
by: Angus | last post by:
Hello I am using some classes from a third party and have included them in my projecxt and am compiling and linking with them. Everything compiles ok but I get these link errors: I added...
2
by: pssraju | last post by:
Hi, At present application was built on solaris 9 using sun studio 9 (Sun C++ 5.6) & rouguewave sorce pro 5. We are planning to port the same application onto SuSE Linux 9.5.0 using GCC 3.3.3 & RW...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.