PC Review


Reply
Thread Tools Rate Thread

how to write vb code in access 2007

 
 
tjbvo
Guest
Posts: n/a
 
      15th Dec 2009
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
 
Reply With Quote
 
 
 
 
xps35
Guest
Posts: n/a
 
      15th Dec 2009
On 15 dec, 13:29, tjbvo <(E-Mail Removed)> wrote:
> 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
 
Reply With Quote
 
 
 
 
Mr. B
Guest
Posts: n/a
 
      15th Dec 2009
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


"tjbvo" wrote:

> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Write code to Write Code Kstalker Microsoft Excel Programming 6 25th Nov 2005 01:30 AM
Code to write out all lines of code davidm Microsoft Excel Programming 3 5th Aug 2005 04:26 AM
[New] Zipoid - ZIP Code, City Name and Area Code Lookup - Zip Code to Zip Code Distance Calculation Mel Freeware 0 22nd Jul 2005 04:13 PM
Write a code by code Microsoft Excel Misc 1 23rd Mar 2005 03:34 PM
Write a code with another code JJ Microsoft Excel Programming 5 23rd Mar 2005 03:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:14 AM.