用于更新MS Access 2010中的余额的VBA代码 [英] VBA Code to Update Balances in MS Access 2010

查看:85
本文介绍了用于更新MS Access 2010中的余额的VBA代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为MiniInvSch的子表单,其中包含以下字段和数据类型


ChartID - 自动编号字段

付款周期 - 数字字段

借记 - 货币字段

信用货币字段

DebitDate - 日期/时间字段

EndingBalance - 货币字段



我想做的是每次付款后,数据库应查看上一个字段,然后将新信用添加到上一个结束余额以获得新的结束余额。我试过但它根本不工作


这是我使用的代码。不要担心第一个方面!处理付款输入框

I have a subform called MiniInvSch with the following fields and Data types

ChartID - Autonumber field
Payment Cycle - Number field
Debit- Currency field
Credit- Currency field
DebitDate - Date/Time field
EndingBalance - Currency field


What I want do is that after every payment, The database should look into the previous field and add then new credit to the previous Ending balance to get a new Endingbalance. I have tried but it is simply not working

This is the code I used. Do not worry about the first aspect! which deals with the payment input box

展开 | 选择 | Wrap | 行号

推荐答案

请将您的代码放入代码块。为此,单击[CODE /]按钮,然后将代码粘贴到标签之间。


1.摆脱您的请求。执行requery没有任何意义,并且会为您想要获取记录集克隆的书签而烦恼。


2.通过执行
Please put your code in a code block. To do that, click on the [CODE/] button and then paste your code between the tags.

1. Get rid of your requery. Doing the requery serves no purpose and messes with the bookmark you want to get for the recordsetclone.

2. Begin the code by doing
展开 | 选择 | Wrap | 行号


好的感谢Jim,但我想知道代码的问题:
Ok thanks Jim but I want to know the problem with the code:
展开 | 选择 | Wrap | 行号


您可能会发现修复Jim提到的问题可以解决您的其他问题。错误有一种层叠和影响其他代码的方式。


另外,我们不知道你的问题是什么。你永远不会说具体是什么不工作。只是说某事不起作用并没有告诉我们什么。您需要具体,告诉我们症状,行号和错误消息。
You may find that fixing the problems Jim mentioned could fix your other problems. Errors have a way of cascading down and affecting other code.

Also, we don''t know what your problem is. You never say what exactly is "not working". Just saying something is not working doesn''t tell us anything. You need to be specific, tell us the symptoms, the line number, the error messages.


这篇关于用于更新MS Access 2010中的余额的VBA代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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