Error 3078 received using the 'OpenRecordset' statement

G

Guest

Hi,

The following code was working but now isn't. I'm not sure what I changed
(if anything) to get the error. The table 'Tbl_Filenames' does exist, a
sub-form 'Tbl_Filenames subform' has it as it's control source. The error is:

'Run time error 3078'

The Microsoft Jet database engine cannot find the input table or query
'Tbl_Filename'. Make sure it exists and that the name is spelled correctly.

The code is:

Private Sub Btn_Import_Selected_Files_Click()
Dim MyTable As DAO.Recordset
Dim MySet As DAO.Recordset
Dim DB As DAO.Database
Dim MyDB As DAO.Database

Set DB = CurrentDb()

iResponse = MsgBox("This will delete all existing data in tables 'Tbl' &
'Tbl_Raw'. Do you with to continue?", vbYesNo, "File Import")
If iResponse = vbNo Then
Exit Sub
End If

DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE Tbl_RAW.* FROM Tbl_RAW; "
DoCmd.RunSQL "DELETE Tbl.* FROM Tbl; "
DoCmd.SetWarnings True

Set MyDB = DBEngine.Workspaces(0).Databases(0)

********************************************
********************************************

The following line is where the error occurs

Set MySet = MyDB.OpenRecordset("Tbl_Filenames")

********************************************
********************************************

MySet.MoveFirst
Do Until MySet.EOF
If MySet![Import] = True Then
The_Path = Me.[Txt_Path].Value
SysCmd acSysCmdSetStatus, "Importing File No " &
Mid(MySet![The_FileName], 29, 1)
DoCmd.TransferText acImportDelim, "PO_Specs", "Tbl_RAW",
The_Path & MySet![The_FileName]
End If
MySet.MoveNext
Loop
SysCmd acSysCmdSetStatus, " "
MySet.Close

End Sub

An explanation of what

Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set MySet = MyDB.OpenRecordset("Tbl_Filenames")

does would really help as I copied this code from an application written by
someone else and I'm not sure what it actually does.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top