如何使用在数据库中找到的记录来执行其他操作

发布于 2024-12-09 04:56:15 字数 301 浏览 2 评论 0原文

我正在数据库中搜索一条记录,现在已找到该记录 我想知道如何使用它 例如 如果我想使用记录的名称字段来输入文本,

If rsQ.RecordCount <> 0 Then
     ' Found it
    blnExists = True
    NameTxt.Value = Name.Value
Else
MsgBox "not found"
End If

它会在这一行给我一个无效的限定符

 NameTxt.Value = Name.Value

I was searching for a record in my database and now that the record is found
I want to know how can I use it
for example
if i want to use the name field of the record to put in text

If rsQ.RecordCount <> 0 Then
     ' Found it
    blnExists = True
    NameTxt.Value = Name.Value
Else
MsgBox "not found"
End If

It gives me an Invalid qualifier at this line

 NameTxt.Value = Name.Value

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若有似无的小暗淡 2024-12-16 04:56:15

你说的是VBA,但没有说你正在使用哪个数据库。从上面来看,您似乎在 Access 中使用 DLookUp 会更好。否则,您可以说:

MyVar = rsQ.Fields("[Name]")

或者

MyVar = rsQ.Fields(3)

BTW Name 是保留字,不应使用。

You say VBA but not which database you are using. From the above, it looks like you would be better off with DLookUp in Access. Otherwise, you can say:

MyVar = rsQ.Fields("[Name]")

Or

MyVar = rsQ.Fields(3)

BTW Name is a reserved word and should not be used.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文