dbTalk Databases Forums  

Error 3078 when maintaining connection to tables on server

comp.databases.ms-access comp.databases.ms-access


Discuss Error 3078 when maintaining connection to tables on server in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sara
 
Posts: n/a

Default Error 3078 when maintaining connection to tables on server - 03-10-2011 , 09:59 AM






I found code to maintain a persistent connection to my tables on a
server (http://www.fmsinc.com/microsoftaccess/performance/
linkeddatabase.html). This is supposed to keep things fast, and it
seems to work. However, now Allen Browne's ConcatRelated function
gives me an Error 3078. When I comment out the openalldatabases true
arguement, it works fine. Any suggestions?

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Error 3078 when maintaining connection to tables on server - 03-10-2011 , 10:56 AM






Sara wrote:
Quote:
I found code to maintain a persistent connection to my tables on a
server (http://www.fmsinc.com/microsoftaccess/performance/
linkeddatabase.html). This is supposed to keep things fast, and it
seems to work. However, now Allen Browne's ConcatRelated function
gives me an Error 3078. When I comment out the openalldatabases true
arguement, it works fine. Any suggestions?
What is the description of Error 3078? And which line in Allen's function
throws the error? You will likely have to step through the code with the
debugger to find out. Open the module containing his code and set a
breakpoint on the first executable line in his function, and then run it.

Reply With Quote
  #3  
Old   
Sara
 
Posts: n/a

Default Re: Error 3078 when maintaining connection to tables on server - 03-10-2011 , 11:53 AM



I believe the part that is causing the issue in the ConcatRelated
function is this line:
Set rs = DBEngine(0)(0).OpenRecordset(strSql, dbOpenDynaset)

Error 3078 says that the "access database engine can't find the input
table or query"

The query is there and I can open the query with no issues.

Reply With Quote
  #4  
Old   
Bruce
 
Posts: n/a

Default Re: Error 3078 when maintaining connection to tables on server - 03-10-2011 , 12:34 PM



I looked at both of these bits of code and don't see exactly why you shouldget that error but stepping through the code as Bob suggested is a good idea to start if you want to continue using that approach. That being said, I don't like the FMS approach to keeping persistent open database connections. They create persistent connections which a) may be connections to databases you don't always use and b) you are not allowed to utilize directly. I prefer to create these persistent connections as public properties whichare only set if you actually use them and which are then usable directly in your code as database objects. For example the following gives you a reusable pointer to the Northwind database:

Public Property Get NorthwindDB(Optional fReset As Boolean = False) As DAO.Database

Const MYPATH As String = "C:\Program Files\Microsoft Office\Office11\Samples\Northwind.mdb"
Static db As DAO.Database

On Error GoTo NorthwindDb_Error

If fReset Or (db Is Nothing) Then Set db = DBEngine.Workspaces(0).OpenDatabase(MYPATH)

Set NorthwindDB = db

On Error GoTo 0
Exit Property

NorthwindDb_Error:

MsgBox "Error " & Err.Number & ": " & Err.Description, vbExclamation, "NorthwindDb()"

End Property

Now I can (re)use this property in my code e.g.

Dim rst as DAO.Recordset
set rst = NorthwindDb.OpenRecordset("Customers")
....

In your case I would modify the ConcatRelated function to accept an optional database parameter so that you can use an external database reference instead of dbengine(0)(0). For example, see the following function that showshow many tables are in a database:

Function HowManyTables(Optional db As DAO.Database = Nothing) As Integer

If db Is Nothing Then
HowManyTables = DBEngine(0)(0).TableDefs.Count
Else
HowManyTables = db.TableDefs.Count
End If

End Function

At the debug prompt you could type
?HowManyTables()
to return the number of tables in the current database or you could includethe optional database parameter
?HowManyTables(NorthwindDb)
to return the number of tables in the Northwind database.

To sum up, I would not use the FMS code but would create public properties in a code module to reference your external databases and would rewrite theConcatRelated function to accept an optional database parameter. Hope this helps!

Bruce

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.