access 2007:在单个绑定文本框中输入多个条目

发布于 2024-10-01 19:52:18 字数 212 浏览 0 评论 0原文

我有一个表单,链接到一个表。该表单具有三个绑定文本框,每个文本框都允许将数据输入到表中。在文本框中输入日期、金额以及收取邮资的客户。我的问题是,如果我有多个客户,按单一费用计费怎么办?

我想更改客户端输入文本框,以便我可以输入多个客户端,并用逗号分隔,并且访问将知道获取输入的金额并将其除以输入的客户端数量。

这可能吗?任何帮助将不胜感激!我大部分时间都是自学的,而且不太懂事。

I have a single form, linked to a single table. The form has three bound text boxes, each allow for data entry to the table. In the text boxes you enter a date, a dollar amount, and a client to bill for the postage. My problem is what if I have multiple clients, billed to a single expense.

I want to alter the client entry text box so that i can type in multiple clients, seperated by a comma, and access will know to take the amount entered and divide it between the number of clients entered.

Is this possible? Any help would be appreciated! I taught myself access for the most part and am not very savvy.

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

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

发布评论

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

评论(1

难如初 2024-10-08 19:52:18

首先我要说这不是一个好主意,但是,如果是供您个人使用,您可以使用 VBA 来分割文本字符串并获取计数,您可能会遇到很多问题,具体取决于如何使用绑定字段已设置。

我建议的是一个列表框、两个文本框和一个子表单。使用多选列表框,您可以选择一个或多个客户端。一些代码将允许您迭代列表并将记录插入到每个客户的表中,其中日期和金额除以列表计数。子表单将显示插入的记录以供检查。

例如:

For Each itm In Me.ListBox.ItemsSelected
  sSQL = "INSERT INTO MyTable (ClientID, Amount, InvDate ) " _
       & "VALUES ( " & Me.ListBox.Column(0, itm) & "," _
       & Me.txtAmount / Me.ListBox.ItemsSelected.Count & ",#" _
       & Me.txtDate & "#)"
  CurrentDB.Execute sSQL, dbFailOnError
Next

Me.SubformControlName.Form.Requery

Let me start by saying this is not a good idea, however, if it is for your personal use, you can use VBA to split the text string and get a count, you are likely to run into a number of problems, depending on how the bound field is set up.

What I would suggest is a listbox, your two text boxes, and a subform. Using a muti-select listbox you can choose one or several clients. A little code will allow you to iterate through the list and insert a record into a table for each client, with the date and the amount divided by list count. The subform will show the inserted records for checking.

For example:

For Each itm In Me.ListBox.ItemsSelected
  sSQL = "INSERT INTO MyTable (ClientID, Amount, InvDate ) " _
       & "VALUES ( " & Me.ListBox.Column(0, itm) & "," _
       & Me.txtAmount / Me.ListBox.ItemsSelected.Count & ",#" _
       & Me.txtDate & "#)"
  CurrentDB.Execute sSQL, dbFailOnError
Next

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