Dear Friends

I m trying to import csv file into access table using vb code. It works for the first time, when 2nd time I try the same option I get the error message:

Run-time error '2075'

"This Operation Required an Open Database"

Here is the code

Dim dbs As Database
Dim rsttemp As Recordset
Dim rstmls As Recordset
Dim strdb2 As String
Dim appaccess As Access.Application

Set appaccess = CreateObject("Access.Application")
strdb2 = Dir1.Path & "\Prea.mdb" 'Main Database
appaccess.OpenCurrentDatabase strdb2

DoCmd.DeleteObject acTable, "mlstemp"
************************************************** *****
Error message comes at this line of the code
DoCmd.TransferText acImportDelim, , "mlstemp", selectedfile, 0
************************************************** ******
DoCmd.DeleteObject acTable, "datafile_mls_importerrors"
appaccess.CloseCurrentDatabase

Set dbs = OpenDatabase(strdb2)
Set rsttemp = dbs.OpenRecordset("mlstemp")
If rsttemp.EOF Then Exit Sub

Set rstmls = dbs.OpenRecordset("mls")
rstmls.Index = "PrimaryKey"
rsttemp.MoveNext
Do Until rsttemp.EOF
rstmls.Seek "=", rsttemp!F23
If rstmls.NoMatch Then
rstmls.AddNew
Else
rstmls.Edit
End If
updatemls rstmls, rsttemp
rstmls.Update
rsttemp.MoveNext
Loop
dbs.Close

Can anyone help me on this issue.

Thanks

Gill