Unanswered: Access data to be stored in Userform Listbox
Hope you all are doing great,
This forum is really very great to help other,
I have a code where I want the access table database to show it on the userform listbox in excel vba.
however I m getting an error as file could not be found, checked the path as well but it doesn't resolved:
My code goes here:
Private Sub Access_to_database()
'Microsoft ActiveX Data Objects 2.8 Library-Activate
On Error GoTo UserForm_Initialize_Err
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.recordSet
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = E:\SAMI.accdb"
rst.Open "SELECT (CSTName),(EmailSub) FROM SAMI_Data ORDER BY [EmailSub];", _
Loop Until rst.EOF
On Error Resume Next
Set rst = Nothing
Set cnn = Nothing
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical, "Error!"
Many thanks in advance, if somebody can really help me.