G
Guest
I have a little application that imports dbase IV files from two different
sources. One source is the database of student information system software
where the file names of each file consist of four alpha characters, which is
followed by one numerical character that denotes the current year, and ending
with three numerical characters that denote the school number, such as
ABCD6123.DBF. The second source is test score data saved in a different
location, and was originally an Excel file saved as a dbase IV file named
CRCT2006, where 2006 is the year tested. The application has a table named
SETUP where the user can enter the path to these data files, the current
year, school number, year tested, and other pertinent entries. When I run the
function shown below the files from the student information system software
database import fine, but the function returns the message "The Microsoft Jet
database engine could not find the object 'CRCT2006'. Make sure the object
exists and that you spell its name and the path name correctly" when it
attempts to import the test score data file.
Function Get_Files()
Dim Path1 As String
Dim Path2 As String
Dim Sch_Yr As Integer
Dim School_Number As String
Dim File_Name As String
Dim Test_Yr As Integer
Set rs = CurrentDb.OpenRecordset("SELECT * FROM SETUP")
Path1 = rs!SIS_DATAFILE_PATH
Path2 = rs!TESTDATA_FILE_PATH
Sch_Yr = rs!SIS_SCHOOL_YEAR
School_Number = rs!SIS_SCHOOL_NUMBER
File_Name = rs!TEST_DATA_FILENAME
Test_Yr = rs!YEAR_TESTED
Set rs = Nothing
DoEvents
On Error GoTo ErrorHandler
DoCmd.TransferDatabase acImport, "dbase IV", _
Path1, acTable, "ASTU" & Sch_Yr & School_Number, "ASTU"
DoCmd.TransferDatabase acImport, "dbase IV", _
Path1, acTable, "SGAD" & Sch_Yr & School_Number, "SGAD"
DoCmd.TransferDatabase acImport, "dbase IV", _
Path2, acTable, File_Name & Test_Yr, "TESTDATA"
Exit Function
ErrorHandler:
MsgBox Err.Description
End Function
Yet, when I rename the CRCT2006.DBF file as CRCT.DBF and remove the "&
Test_Yr" text from the function above, the function will successfully import
the file. What could be happening here?
Thanks in advance, and apologize for the long explanation.
RC
sources. One source is the database of student information system software
where the file names of each file consist of four alpha characters, which is
followed by one numerical character that denotes the current year, and ending
with three numerical characters that denote the school number, such as
ABCD6123.DBF. The second source is test score data saved in a different
location, and was originally an Excel file saved as a dbase IV file named
CRCT2006, where 2006 is the year tested. The application has a table named
SETUP where the user can enter the path to these data files, the current
year, school number, year tested, and other pertinent entries. When I run the
function shown below the files from the student information system software
database import fine, but the function returns the message "The Microsoft Jet
database engine could not find the object 'CRCT2006'. Make sure the object
exists and that you spell its name and the path name correctly" when it
attempts to import the test score data file.
Function Get_Files()
Dim Path1 As String
Dim Path2 As String
Dim Sch_Yr As Integer
Dim School_Number As String
Dim File_Name As String
Dim Test_Yr As Integer
Set rs = CurrentDb.OpenRecordset("SELECT * FROM SETUP")
Path1 = rs!SIS_DATAFILE_PATH
Path2 = rs!TESTDATA_FILE_PATH
Sch_Yr = rs!SIS_SCHOOL_YEAR
School_Number = rs!SIS_SCHOOL_NUMBER
File_Name = rs!TEST_DATA_FILENAME
Test_Yr = rs!YEAR_TESTED
Set rs = Nothing
DoEvents
On Error GoTo ErrorHandler
DoCmd.TransferDatabase acImport, "dbase IV", _
Path1, acTable, "ASTU" & Sch_Yr & School_Number, "ASTU"
DoCmd.TransferDatabase acImport, "dbase IV", _
Path1, acTable, "SGAD" & Sch_Yr & School_Number, "SGAD"
DoCmd.TransferDatabase acImport, "dbase IV", _
Path2, acTable, File_Name & Test_Yr, "TESTDATA"
Exit Function
ErrorHandler:
MsgBox Err.Description
End Function
Yet, when I rename the CRCT2006.DBF file as CRCT.DBF and remove the "&
Test_Yr" text from the function above, the function will successfully import
the file. What could be happening here?
Thanks in advance, and apologize for the long explanation.
RC