有没有一种方法可以使用行和列索引来更改访问表中的单个单元格

时间:2019-04-26 13:14:21

标签: c# ms-access

嘿:)试图在文本框中的访问表的单个单元格中显示文本,我该如何读取该特定单元格对于数据库来说是新的,所以我只能深入到连接数据库本身。

1 个答案:

答案 0 :(得分:0)

您可以将表作为记录集读取,移至记录并读取字段:

Dim rs     As DAO.Recordset

Dim Row    As Long
Dim Column As Long
Dim Value  As Variant

' Example. First is no. 1:
Row = 15
Column = 2

Set rs = CurrentDb.OpenRecordset("Select * From Tabel1 Order By Dato")
' Read all records.
rs.MoveLast
rs.MoveFirst
' Go to record.
rs.Move Row - 1
' Read field.
Value = rs.Fields(Column - 1).Value

Debug.Print Value

rs.Close