hi,
here is some code i got from a site. ive made some changes and tried it but doesnt work. need help
====================================
Private Sub cmdGetRows_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strqry As String
Dim strFieldValue As String
Dim varRecords As Variant
Dim intRecord As Integer
Dim intField As Integer
strqry = "uno" (this is a query)
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strqry, dbOpenSnapshot)
varRecords = rst.GetRows(1)
(here don't know what to do?)
restxt.Value = varRecords(1)
End Sub
====================================
Private Sub cmdGetRows_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strTable As String
Dim strFieldValue As String
Dim varRecords As Variant
Dim intRecord As Integer
Dim intField As Integer
strTable = "items"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strTable, dbOpenSnapshot)
varRecords = rst.GetRows(10)
Debug.Print "Fourth field in fifth record: " & varRecords(5, 6)
End Sub
=============================
i get this message:
error is:
run-time error '9':
Subscript out of range
=======================
what does this do: varRecords(5, 6)?
thanks
here is some code i got from a site. ive made some changes and tried it but doesnt work. need help
====================================
Private Sub cmdGetRows_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strqry As String
Dim strFieldValue As String
Dim varRecords As Variant
Dim intRecord As Integer
Dim intField As Integer
strqry = "uno" (this is a query)
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strqry, dbOpenSnapshot)
varRecords = rst.GetRows(1)
(here don't know what to do?)
restxt.Value = varRecords(1)
End Sub
====================================
Private Sub cmdGetRows_Click()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strTable As String
Dim strFieldValue As String
Dim varRecords As Variant
Dim intRecord As Integer
Dim intField As Integer
strTable = "items"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strTable, dbOpenSnapshot)
varRecords = rst.GetRows(10)
Debug.Print "Fourth field in fifth record: " & varRecords(5, 6)
End Sub
=============================
i get this message:
error is:
run-time error '9':
Subscript out of range
=======================
what does this do: varRecords(5, 6)?
thanks