how to write vb code in access 2007

  • Thread starter Thread starter tjbvo
  • Start date Start date
T

tjbvo

Version: MSAccess 2007

I have 3 fields in my database that contain currency.
Field 1: PrincipleAmount
Field 2: AmountPaid
Field 3: AmountDue

I have added a Command Button (cmdCalc) to the form.
I need to write code that Subtracts Field2 from Field1 and returns the
Balance in Field 3.

I have no idea on how to gain access to and how to write code in MSAccess
2007.
I can do this in VB6.

Thanking You in Anticipation
Julian
 
Version: MSAccess 2007

I have 3 fields in my database that contain currency.
Field 1: PrincipleAmount
Field 2: AmountPaid
Field 3: AmountDue

I have added a Command Button (cmdCalc) to the form.
I need to write code that Subtracts Field2 from Field1 and returns the
Balance in Field 3.

I have no idea on how to gain access to and how to write code in MSAccess
2007.
I can do this in VB6.

Thanking You in Anticipation
Julian

You do not need Field 3 in your database. Fields like these only cause
corrupt data (in case you forget to push the button).
If you want to show the amount dua in e.g. a query just make an
calculeted field in the query: PrincipleAmount - AmountPaid.

Groeten,

Peter
http://access.xps350.com
 
You don't need the command button or any VBA code to do what you want.

Select the text box where you want the result of the calculation and display
the Properties Dialog box. Locate the Data Tab and then locate the "Control
Source" property. In that row type:

= [NameOfFirstTextBox] - [NameOfSecondTextBox]

Just be sure to supply the actual names of the controls that will supply the
values to be calculated.

-----
HTH
Mr. B
http://www.askdoctoraccess.com/
Doctor Access Downloads Page:
http://www.askdoctoraccess.com/DownloadPage.htm
 
Back
Top