Error - Record(s) can't be read, no read permissions on

M

mju

How do i get rid of this error?? I copied a database. I am tryong to change
the combo box from nound to unbound object. I have checked off all the
required boxed under tool-options- view. I have also granted access to the
table. I dont know what else to do. below is a sample of the code.
Your help will greated be appreciated.

Private Sub Form_Load()
On Error GoTo UserForm_Initialize_Err
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim con As String, strConn


strConn = " C:\Documents and
Settings\Sp-0010\Desktop\2010-css-database\S-DB_BE.mdb"

'strConn = " E:\New Folder\css-db_be.mdb"
'strConn = "css-db_be.mdb"
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & strConn


rst.Open "SELECT DISTINCT [tblRetailer.RtRetailerName] FROM tblRetailer
ORDER BY [tblRetailer.RtRetailerName];", _
cnn, adOpenStatic
rst.MoveFirst
With Me.RdcRetailerNameComboBox
Do
.AddItem rst![tblRetailer.RtRetailerName]
rst.MoveNext
Loop Until rst.EOF
End With
UserForm_Initialize_Exit:
On Error Resume Next
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Exit Sub
UserForm_Initialize_Err:
MsgBox Err.Number & vbCrLf & Err.Description, vbCritical, "Error!"
Resume UserForm_Initialize_Exit
End Sub
 

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