gpt4 book ai didi

ms-access - 如何 Access 记录集中的值

转载 作者:行者123 更新时间:2023-12-05 00:04:09 25 4
gpt4 key购买 nike

以这段代码为例:

sSQL = "select CtyMarket from Market where Country = '" & Country.Value & "'"
Set rec = CurrentDb.OpenRecordset(sSQL)

此语句可以返回多个值。我如何 Access 这些值?

最佳答案

好吧,为了获得所有值,您可以浏览记录集中的字段和记录。它看起来像这样:

'You'll need to declare a new variable
Dim i as long

If rec.EOF and rec.BOF then
Else
do while not rec.EOF
for i = 0 to rec.fields.count - 1
debug.print rec.fields(i).value
next i
rec.movenext
loop
endif

获取数据的其他方法是使用记录集对象的 getrows 和/或 getstring 方法,但我不记得这些方法是否适用于 DAO 记录集。您还可以为特定字段上的特定值设置过滤器等

关于ms-access - 如何 Access 记录集中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5986402/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com