Hi,
I'm working on a VB Project in which I'm importing an Excel detasheet
into Access Database using this code using a CommonDialog Control

Public Sub cmdSelectDataPath_Click()

On Error GoTo Err_CS

'Select an image file to open
With dlgSelectDataFile
.CancelError = True
.DialogTitle = "Select Data File..."
.Filter = " Excel Data Sheet(*.xls)"
.ShowOpen
txtDataPath = .FileName
If Trim$(txtDataPath.Text) <> "" Then
DoCmd.TransferSpreadsheet acImport, 8, "FabricData",_ txtDataPath.Text,
-1
End If
End With


Exit Sub

Err_CS:

If Err.Number = 2075 Then 'User cancelled
Err.Raise Err.Number, Err.Source, Err.Description
Err.Clear
End If

End Sub

This is working fine until I open the Access Database along with runnning
the VB application. It gives Run-time 2075 and gives a message "This Operation
requires an Open Database"

I'm not able to resolve this problem, can anyone help me with this? I have
used ADODB Connection object to connect to the database and open its recordset.
A reply would be greatly appreciated.


Thanks,
Shravan