Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My code stops at this line
Set myRs = myQDef.OpenRecordset and gives me error msg of Record(s) cannot be read; no read permission on €śEnd_Year_incentive€ť I dont understand because I am one of the Admin on this database with all permissions. Is something to due with the code? Public Sub CreateQDef() Dim myDB As DAO.Database Dim myQDef As DAO.QueryDef Dim myRs As DAO.Recordset Dim DBFullName As String, sqlStr As String Dim I As Integer, ms As Integer ' DBFullName = "\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Trade_limit.mdb" Set myDB = OpenDatabase(DBFullName) sqlStr = "SELECT *" & _ "FROM[End_of_year_incentive] ;" ' .Open "SELECT * FROM " & [End of year incentive] & _ ' " WHERE [AS400 #] = 'Range.Cells(1, 1)' ", cn, , , adCmdText Set myQDef = myDB.CreateQueryDef("", sqlStr) Set myRs = myQDef.OpenRecordset myRs.MoveFirst I = 2 With myRs If Not .BOF Then .MoveFirst Do While Not .EOF Cells(I, 1).Value = .Fields(0) Cells(I, 2).Value = .Fields(1) .MoveNext I = I + 1 Loop End With myRs.Close myDB.Close Set myQDef = Nothing Set myDB = Nothing Set myRs = Nothing End Sub Public Sub DAO_Example() Dim dbNorthwind As DAO.Database Dim dbpath As String Dim I As Integer dbpath = "\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\Trade_limit.mdb" Set dbTrade_limit = OpenDatabase(dbpath) Dim rsEnd_of_year_incentive As DAO.Recordset Set rsEnd_of_year_incentive = dbTrade_limit.OpenRecordset("End_of_year_incentive ", dbOpenTable) I = 2 With rsEmployees If Not .BOF Then .MoveFirst Do While Not .EOF Cells(I, 1).Value = .Fields(2) 'First name in third column Cells(I, 2).Value = .Fields(1) 'Last name in second column .MoveNext I = I + 1 Loop End With rs.End_of_year_incentive.Close dbTrade_limit.Close Set rsEnd_of_year_incentive = Nothing Set dbTrade_limit = Nothing End Sub Private Sub CommandButton1_Click() CreateQDef End Sub -- ca1358 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Use Permissions | Excel Discussion (Misc queries) | |||
Permissions | Excel Worksheet Functions | |||
Permissions | Excel Discussion (Misc queries) | |||
Permissions | Excel Worksheet Functions | |||
Setting read only permissions | Excel Discussion (Misc queries) |