Hi John,
I get the same 2507 error with the "LinkTest"
code below as I do with the code in the broader
scope of the application (InitVer9_Part1):
Option Compare Database
Option Explicit
Private Sub LinkTest()
Dim BEdatabase As Variant
BEdatabase = "c:\gcc\gcc data.mdb"
DoCmd.TransferDatabase acLink, , BEdatabase, acTable, "tblsermons"
End Sub
However, if you want to see tha actual application code,
here it is: (Note that IPDatabase is a global string variable
whose current value is "c:\gcc\gcc data.mdb".)
Private Sub InitVer9_Part1()
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
' TableDef the "Sermon Table" and add all of
' its fields. (Thanks Allen Browne.)
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Dim db As DAO.database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
On Error GoTo Err_InitVer9_Part1
'Initialize the Sermons table.
Set db = DBEngine.Workspaces(0).OpenDatabase(IPDatabase)
Set tdf = db.CreateTableDef("tblSermons")
'Specify the fields.
With tdf
'AutoNumber: Long with the attribute set.
Set fld = .CreateField("SermonID", dbLong)
fld.Attributes = dbAutoIncrField + dbFixedField
.Fields.Append fld
'Append the required special date expression field
Set fld = .CreateField("SDate", dbText, 16)
fld.Required = True
fld.AllowZeroLength = False
.Fields.Append fld
'Append the Scripture book name field
Set fld = .CreateField("SBook", dbText, 20)
fld.Required = False
fld.AllowZeroLength = True
.Fields.Append fld
'Append the Scripture reference field
Set fld = .CreateField("SReference", dbText, 20)
fld.Required = False
fld.AllowZeroLength = True
.Fields.Append fld
'Append the field for presenters name
Set fld = .CreateField("SPresenter", dbText, 50)
fld.Required = False
fld.AllowZeroLength = True
.Fields.Append fld
'Append the field for comments
Set fld = .CreateField("SComments", dbText, 50)
fld.Required = False
fld.AllowZeroLength = True
.Fields.Append fld
'Append the field for the file type
Set fld = .CreateField("SFileType", dbText, 6)
fld.Required = True
fld.AllowZeroLength = False
.Fields.Append fld
'Append the field for the file name
Set fld = .CreateField("SFileName", dbText, 100)
fld.Required = True
fld.AllowZeroLength = False
.Fields.Append fld
End With
'Save the Sermons table.
db.TableDefs.Append tdf
Set fld = Nothing
Set tdf = Nothing
'Now link the front end to the new table.
DoCmd.TransferDatabase acLink, , IPDatabase, acTable, "tblsermons"
End_InitVer9_Part1:
Exit Sub
Err_InitVer9_Part1:
MsgBox Err.Number & ": " & Err.Description
UpdateStatus = False
Resume End_InitVer9_Part1
End Sub