bogus error message 3125 (1 Viewer)

AlanS

Registered User.
Local time
Today, 01:08
Joined
Mar 23, 2001
Messages
292
I have an Access 97 database which is used to design tables which are then built in SQL Server 2000. As new tables and fields are added to the designs, or old ones are modified, I have VBA code which generates an SQL script to build or modify the tables as per the current designs, as well as related stored procedures. Part of the process involves determining whether or not a given table already exists in SQL Server, as the SQL code generated for it must be different for new vs. old tables. All this has worked great for over a year, for close to 200 tables. The code I am using is shown below.

All of a sudden, I am getting a bogus error message, but only for one particular table, whose name is 23 characters long and consists entirely of letters. The error message is:

Run-time error '3125': The database engine can't find 'ExistSQL'. Make sure it is a valid parameter or alias name, that it doesn't include invalid characters or punctuation, and that the name isn't too long. The error occurs on the "DoCmd.TransferDatabase" statement. "ExistSQL" is the value of the LocalName parameter, which never changes, yet the error only occurs when TableName is "FinancePaymentsComments".

Does anyone have a clue about what's going on here?


Code:
Function ExistSQL(TableName As Variant) As Boolean
    'returns a Boolean value indicating whether TableName exists in the SQL database Production
    Const DatabaseType = "ODBC Database"
    Const ConnString = "ODBC;WSID=PWDC-DB;Trusted_Connection=Yes;DATABASE=Production;DSN=PWDCProduction"
    Const LocalName = "ExistSQL"
    If IsNull(TableName) Then
        ExistSQL = False
    Else
        'On Error GoTo ExistSQL_Err
        DoCmd.TransferDatabase acLink, DatabaseType, ConnString, acTable, TableName, LocalName, True, False
        ExistSQL = True
        CurrentDb.TableDefs.Delete LocalName
    End If
ExistSQL_Exit:
    Exit Function
ExistSQL_Err:
    ExistSQL = False
    GoTo ExistSQL_Exit
End Function
 
Last edited by a moderator:

pdx_man

Just trying to help
Local time
Yesterday, 22:08
Joined
Jan 23, 2001
Messages
1,347
Hmmm ... worked for me ... check to make sure that you do not have any other objects under the same name, but with different owner on SQL Server. It may be getting confused.
 

AlanS

Registered User.
Local time
Today, 01:08
Joined
Mar 23, 2001
Messages
292
Thanks, pdx_man. All objects in the database are owned by dbo. This ended up being one of those cases where the problem gets resolved, but you never know what caused or what fixed it. I ended up deleting the three new tables I was creating in this batch, and all of their stored procedures, and then re-running my code generator (including the code I posted). This time, everything ran perfectly - go figure.
 

Users who are viewing this thread

Top Bottom