表格上的倒计时框 [英] Countdown box on a form

查看:48
本文介绍了表格上的倒计时框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我为自己的数据库疯狂了解我遇到的问题我想解决这个问题。

为了解决这个问题,我有2个表:

TblA,包含字段[IDTblA]和[Customer]。相关表格名为frmA

TblB,字段为[IDTblB],[Payments],[RemainingDebt]。

我还创建了一个基于客户的表格FrmB(来自TblA )使用子表单SubFrmB(后者显示来自TblB的所有字段)。

到目前为止一切顺利。

现在我的问题。

每个客户在TblB字段[RemainingDebt]中输入的第一个数据是他的初始债务(对于未付发票)。此字段不显示其他数据。

同一表格中的[付款]字段也为每位客户提供其初始债务金额,并在减号时显示付款(在不同日期进行) )减少他们的初始债务。

过滤的SubfrmB显示,对于每个选定的客户:

- 在字段[RemainingDebt],第一行,他的初始债务作为唯一项目;

- 在字段[付款]中他的初始债务和(带减号),在不同日期支付的清单。

在SubfrmB页脚中,我创建了一个带有公式的Txt_Sum字段?=总和([付款]?。

在任何时候,Txt_Sum都会向每个客户显示他剩余的债务。

现在我需要这样,每次我注册新的付款时选定的客户,在过滤的SubFrmB的[付款]字段中,他的初始债务(在同一子表单中的字段[RemainingDebt]中显示为唯一项目)应更改为存储在Txt_Sum中的值(表示其更新的债务)。 br />
换句话说,我需要一个?倒计时?框,在主窗体或其子窗体中显示所选客户的当前剩余债务。任何想法?

Hi!
I?m going crazy with my DB for a problem I?m trying to solve.
Just to get the idea of the problem, I have 2 tables:
TblA with fields [IDTblA] and [Customer]. The related form is named frmA
TblB with fields [IDTblB], [Payments], [RemainingDebt].
I have also created a form FrmB based on Customer (from TblA) with subform SubFrmB (the latter showing all the fields from TblB) .
So far so good.
Now my problem.
The first data entered in field [RemainingDebt] of TblB for each customer is his initial debt (for unpaid invoices). This field shows no further data.
The field [Payments], of the same table, also gets for each customer the amount of his initial debt and, with minus sign, the payments (made at various dates) for reducing their initial debt.
The filtered SubfrmB shows, for each selected customer:
- in field [RemainingDebt], first row, his initial debt as unique item;
- in field [Payments] his initial debt and, (with minus sign), the list of payments made at various dates.
In the SubfrmB footer I have created a Txt_Sum field with the formula ?=Sum([Payments]?.
At any time, Txt_Sum shows for each customer his remaining debt.
Now I need that, every time I register a new payment of a selected customer, in the field [Payments] of the filtered SubFrmB, his initial debt, shown as unique item in field [RemainingDebt] in the same subform, should be changed into the value stored in Txt_Sum (which represents his updated debt).
In other words I need a ?countdown? box either in the main form or in the its subform showing the current remaining debt of a selected customer. Any idea?

推荐答案

快速回答是这样的有很多种方法可以做运行总和。

我建议你查看它们,看看哪一个你喜欢它。


如果你得到卡住了,请回来


Phil
A quick answer is that there are numerous ways to do a "Running Sum".
I suggest you look them up and see which one takes your fancy.

If you get stuck, please come back

Phil


嗨!

谢谢Phil回答。

您可能想知道为什么我需要字段RemainingDebt中的唯一项目是一个运行总和,必须始终在同一行。

事实是,在同一行中subformB还有一个[Duedate]字段和一个[Yes / No]字段。

发出新发票时,两个字段都会获得数据。仅在支付相关发票时才会检查字段[是/否]。现在,[RemainingDebt]也获得[DueDate],对应于最早的未付发票。

我创建了一个查询,返回从未选中的[是/否]中提取的延迟付款清单方框。

该清单还报告延迟天数和延迟金额。如果[RemainingDebt]不是运行总和,则查询返回原始债务,这将是不正确的。

我尝试过更新查询,但到目前为止,未成功。也许我需要一个Txt_Box显示原始的起始债务,但在这里我被卡住了。我对Access vba(和英语)的了解非常基础。
Hi!
Thank you Phil for answering.
You will be probably wondering why I need the unique item in field RemainingDebt to be a “running sum” bound to be always in the same row.
The fact is that in that same row of subformB there is also a [Duedate] field and a [Yes/No] field.
When issuing a new invoice, both fields get data. Field [Yes/No] is checked only when the relevant invoice is paid. Now, the [RemainingDebt] gets a [DueDate], too, corresponding to the oldest unpaid invoice.
I have created a query which returns a list of delayed payments drawn from the unchecked [Yes/No] boxes.
The list reports also the days of delay and the amount in delay. If [RemainingDebt] is not a running sum the query returns the original debt and this would not be correct.
I have tried an update query but, so far, unsuccessfully. Perhaps I need one more Txt_Box showing the original starting debt, but here I get stuck. My knowledge of Access vba (and English) is rather basic.


我会将[RemainingDebt]移动到[Customer]表中。对于InitialBalance,在[付款]表中创建带有负付款的记录。我将创建一个更新查询,用[付款]的总和更新[客户]。[RemainingDebt]。然后,您可以在每次插入或更新[付款]后运行更新查询。然后将Txt_Sum绑定到[Customer]。[RemainingDebt]并将其设为只读。


根据您的Access版本,您可以创建数据宏根据需要运行更新查询。
I would move [RemainingDebt] into the [Customer] Table. For the InitialBalance, create a record with a Negative Payment in the [Payments] Table. I would create an Update Query that updates [Customer].[RemainingDebt] with the Sum of[Payments]. You can then run the Update Query after every insert or update to [Payments]. Then Bind Txt_Sum to [Customer].[RemainingDebt] and make it read-only.

Depending on your version of Access, you could make a Data Macro to run the Update Query as needed.


这篇关于表格上的倒计时框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆