access 2007 一个循环,以一种形式循环遍历特定文本框

发布于 2024-09-24 19:25:47 字数 201 浏览 4 评论 0原文

我的问题如下 我有一个属性表单,其中包含一个名为 DateTo 的文本字段(此文本字段包含数据类型 Date) 我想循环遍历每个属性上的 DateTo 文本字段,并将其打印在消息框中,作为租户名称文本字段和租户地址1 字段。 完成后,我想在消息框中仅显示属性 满足特定条件。 DateTo 文本框中的日期之前一个月,我希望这些值在消息框中打印出来。

任何帮助将不胜感激

my problem is as follows
I have a properties form which contains a textfield called DateTo(this textfield contains the data type Date)
I would like to loop through the DateTo textfield on each of the properties and prints this out in a message box as wasll as a tenantName textfield and a tenantAddress1 field.
After this is complete i would like to display in the message box only the properties
that meets a particular condition. A month before the Date in the DateTo textbox I would like these values to be printed out in a message box.

any help would be greately appreciated

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

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

发布评论

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

评论(1

风柔一江水 2024-10-01 19:25:47

像这样的东西应该给你一个工作框架。

Dim db As DAO.Database
Dim rs1 As DAO.Recordset

Set db = CurrentDb()
Set rs1 = db.OpenRecordset("SELECT DateTo, TenantName, TenantAddress1 FROM " & Me.RecordSource)

If rs1.RecordCount > 0 Then
    rs1.MoveFirst
    Do Until rs.EOF
        MsgBox rs.Fields("DateTo") & ", " & rs.Fields("TenantName") & ", " & rs.Fields("TenantAddress1")
        rs1.MoveNext
    Loop
End If
rs1.Close
set rs1 = Nothing
set db = Nothing

您需要更改 set rs1 = db... 行以包含您要添加的任何条件。

例如:

set rs1 = db.OpenRecordset("SELECT DateTo, TenantName, TenantAddress1 FROM " & Me.RecordSource & " WHERE DateTo >= #1/1/2010#")

或者您正在寻找的任何标准。

Something like this should give you a framework to work from.

Dim db As DAO.Database
Dim rs1 As DAO.Recordset

Set db = CurrentDb()
Set rs1 = db.OpenRecordset("SELECT DateTo, TenantName, TenantAddress1 FROM " & Me.RecordSource)

If rs1.RecordCount > 0 Then
    rs1.MoveFirst
    Do Until rs.EOF
        MsgBox rs.Fields("DateTo") & ", " & rs.Fields("TenantName") & ", " & rs.Fields("TenantAddress1")
        rs1.MoveNext
    Loop
End If
rs1.Close
set rs1 = Nothing
set db = Nothing

You'll need to change the set rs1 = db... line to include whatever criteria you want to add.

Something like:

set rs1 = db.OpenRecordset("SELECT DateTo, TenantName, TenantAddress1 FROM " & Me.RecordSource & " WHERE DateTo >= #1/1/2010#")

Or whatever criteria you are looking for.

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