how to write vb code in access 2007

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
0
Utf
12/15/2009 12:29:01 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

2 Replies
1138 Views

Similar Articles

[PageSpeed] 37

On 15 dec, 13:29, tjbvo <tj...@discussions.microsoft.com> 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
0
xps35
12/15/2009 12:41:08 PM
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
0
Utf
12/15/2009 1:01:02 PM
Reply:

Similar Artilces:

Outlook 2007 Calendar: Private by default
I ran into a scenario where a user was running Outlook 2007, and needed every appointment to be marked as Private by default. Because the form differs so much between Outlook 2003 and 2007, Microsoft's published instructions (http://office.microsoft.com/en-us/outlook/HA011456981033.aspx) do not apply at all to Outlook 2007. I had to figure this out on my own. Here is the procedure in case anyone out there needs this functionality: Outlook 2007: 1) Tools >> Forms >> Design A Form 2) Select Appointment, click Open 3) When the Form Designer comes up, look in the (All Fields...

Command button on click code
Can someone give me and example code to transfer a DB with a command button click to my ftp server? Thanks Klaus ...

Is there a way for Windows Service to Read/Write HKCU Reg key ?
Hi: I'm writing a Windows Service program which needs to read/write the HKEY_CURRENT_USER registry key for the current logged on user. I know that for a Windows service does not have concept of HKCU since it is always running in SYSTEM's context. But is there a way (trick?) for a service to access the HKCU registry key? Thanks In Advance ! Polaris Hello Try, from a user application (the one that is logged on, or the current user), to send the services the user's SID. Then access the HKCU through HKEY_USERS\users_sid\............ Hope that helps, Elias "Polaris&qu...

Write
I am trying to change the default margins. I am requested to use the Write mode to do this. What is Write, and how do I access it? Are you using voice recognition? Margins are simply changed in the Arrange Menu in Publisher. Are you in the right newsgroup? -- Mary Sauer MS MVP http://office.microsoft.com/ http://www.mvps.org/msauer/ news://msnews.microsoft.com "CBC" <anonymous@discussions.microsoft.com> wrote in message news:183bb01c44a40$107bd5d0$a501280a@phx.gbl... > I am trying to change the default margins. I am requested > to use the Write mode to do this. W...

2007-No Offline Help-Stop Auto Update
I just upgraded to Money 2007 from Money 2004. XPHome SP2 IE6. I usually use Money off-line. When I sign in I check the box not to connect to the internet. I have a couple questions.... for now. 1. I do not download statements or pay bills online. Is there a way to stop automatically updating (minute-wise)? I tried entering “00" but that doesn’t work. :)Like in 2004 I just updated manually when I wanted to update my portfolio and read the FYI in the portfolio or read the investing headlines or check quotes, news, etc. I don't want it to continually keep updating. 2. ...

Access 2007 Forms Size
I cannot figure out how to keep Access 2007 from automatically resizing forms to odd sizes. I have a shared database and when it is opened in 2007, the forms are resized and saved to that size when closed, without prompting. ?????? I can set it to tabbed - Ok for 2007, but in 2000 the forms are resized and not viewable on some displays. I need Access 2007 to stop screwing up my forms. HELP! Set the "Allow Design Changes" Property for each form to "Design View Only" For overkill you could also do this: in the VBE, do a Find for "DoCmd.Close acForm" or "D...

M.S. Word 7 came installed with my computer but i can't access it
Ok so when i bought my computer this sofware came installed with it, but now it does not want to work anymore. So i want to know what do i do to fix this. I can log on to it but i can not do anything with it It was a trial version that came pre-installed on your computer. To see how to convert it to a regular version, see "How do I convert my trial?" at: http://us20.trymicrosoftoffice.com/faq.aspx -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally p...

VB Code to copy linked table to local
I have an Access 2007 database with a linked ODBC table that changes on a daily basis. I want to automate a function where the linked table is copied and pasted as a local table. I tried the following command: DoCmd.CopyObject , stNewName, acTable, stTblName It worked, and named the new table correctly (based on an earlier command that assigns the table name with the current date as "stNewName"), but it stayed as a linked table - which means tomorrow, today's data will be lost. Is there a parameter of the CopyObject command that will make the new table local,...

VB to C# help
Hello Any help appreciated. I need to convert this: Protected Sub grdMaster_RowDataBound(ByVal sender As Object, _ ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) _ Handles grdMaster.RowDataBound Dim objListItem As DataControlRowState objListItem = e.Row.RowState Dim intMAsterID1 As Integer If e.Row.RowType = DataControlRowType.DataRow Then Dim grd As GridView If objListItem = 5 Then grd = CType(e.Row.FindControl("grdChildGridEdit"), GridView) MasterTableID = Convert.ToInt32(CType(e...

Cannot write to memory location
I can not (all of the sudden) run Publisher in the last week. When starting to run it, I get that it cannot write to a certain memory locaiton, so it is shutting down. I need to get this program working. I have read through this forum and tried the different fixes as well as the knowledge base (emptied the temp file, disabled anti-virus, etc.) but it still won't work. An example is: "The instruction at "0x77f585c0" referenced memory at "0x00000000". the memory could not be "written". Click on OK to terminate the program." The header read...

write protect/write redirect/kios mode
Hey, I LOVE snapshots in virtualmachines and think it would be awesome to have something like this for my main windows install. Anyone know of any hardware/software to redirect writes to another drive/file/memory/hardware? Or hardware to write protect a drive for kios's (i found some once befor the reverted all changes on shutdown, but cant find it anymore ><) I know VSS(virtual shadow copy service) has a function to redirect on write and wondering if i might be able to use that :/ It will just make everything cleaner, and give alot of flexiblity to setting up ...

Access 2007 Runtime on Machine With Older Version?
A client of mine likes some of the new bells and whistles in Access 2007, and is thinking about converting our A03 format MDB to an A07 format file. However, while some of the users have A07, many do not, and it's not clear when they would get it. His thought was to use the upcoming Access 2007 runtime to allow the users who are still running Office 2003 to be able to run the database. While I use multiple versions of Access on my development machine, I advised him against this, as I recall from years ago with the Access 97 runtime that it caused problems when run on a machine that...

Excel 2007 ribbon issue when in cell edit mode
I have the most basic tab created for the Excel 2007 ribbon, xml at end along with VBA After Excel starts, if I click my tab, my button is enabled and it works. After that, regardless of the state my current cell is in if I go back to my tab, my button is still enabled. However, if when I start Excel I immediately enter something into cell A1, then while still in edit mode I click my tab on the ribbon, I get a beep, and my button is not enabled. Furthermore, it will never become enabled short of disabling my add-in and reloading, or restarted Excel. Interestingly enough, i...

Retrieve data from Access
I have a requirement to import data from MSAccess to Excel. I have done this using VB. The problem is that I use a button on the spreadsheet to run the macro. I want to run the macro after I enter data in a cell and press the enter key. Can this be done and how. Thanks in advance ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ try using the SelectionChange event for the relevant worksheet. Call the macro through here, instead of with the button OnClick event. Edwar...

Help! Keep getting problem in email coding...
I don't know why when I reply a friend's email, she always complain that I sent her scrambled texts... I have checked: If the email is initiated from my Outlook 2003, she has no problem of reading it. The code-set is correct. If the email is originated from her and I reply her, due to her email setting, my Outlook 2003 always use "Unicode UTF-8", which she cannot read. This is annoying. I tried to find a place to change/make Outlook 2003 more smartly... but I could not find the option. There is only one option, but it insists on letting Outlook 2003 "automatical...

Writing formula for excel worksheet
Item Rate1 Rate2 Rate3 A 3 4 6 B 8 5 23 C 56 5 78 Above is my excel sheet. I want to write some formula so that in every row cell having minimum rate should come bold. Like For Item A - Rate1(3) for Item B - Rate2(5) For Item C - Rate2 (5) There may be a neater way but this works. Somewhere in you sheet in a cell type =min(A1:a4), I used L1 Change this to watever range you are trying to evaluate. Then select this range and click format - conditional format - cell value - is equal to =($L$1) and apply your bold font. The lowest value in the range will then become bold. Mike "Gaur...

how do i write checkbox to.....
This is a multi-part message in MIME format. --------------050607000103070200020407 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit how do i write checkbox1 boolean to xml in vb6 i can only do cstr( checkbox1.value) but in vb.net can't write to xml. i am doing irc chat similar to mirc or pirch chat. rw.WriteConfigInfo("User Modes", chkInvisible.Text, chkInvisible.Checked, "PirateChat.xml") in procedure events: ' Both the Key and the Value are filled ' Find the key ...

Outlook 2007 auto archived messages are gone
Hi, If this going to wrong news group, please let me know where I should be posting. Anyway, here goes... I'm having very strange behaviour from some Outlook 2007 installations. When auto archive runs, it does so successfully - creates the archive.pst file (the first time it runs) and then moves the files to the new .pst. However, when I try and have a look at the archived messages, they're gone. Folder size is zero and no messages are moved into the file. The funny thing is that it faithfully recreates the folder structure from the original .pst for messages that meet the archi...

opening Publisher 2003 files in 2007
Previously to installing the update to the Beta I was able to open the files. Now I can't open them. Help. -- MC How to use Office programs with the Norton AntiVirus Office plug-in http://support.microsoft.com/kb/329820/en-us -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com http://officebeta.iponet.net/en-us/publisher/FX100649111033.aspx "MC" <MC@discussions.microsoft.com> wrote in message news:24D0839E-39A2-46E2-8BE5-20424BEEB284@microsoft.com... > Previously to installing the update to the Beta I was able ...

Integration Product Type Code
I'm trying to setup the integration from CRM to GP using the Settings and Administration tool. When I go to setup a link for a Product Type Code, the CRM field is showing a number instead of a name. For example, instead of showing "Discontinued", it's showing "5". I assume this number is the value of the "Discontinued" name, but how can I get it show "Discontinued" instead of "5"? -- Brandon Presentations Direct - "Document Finishing Solutions" http://www.presentationsdirect.com ...

Write access to a LDAP server.
Is there any way to enable write access in Outlook to my LDAP server? The LDAP server allows this functionality, Outlook doesn't. Any plugins that can do this? Thanks. Derek ...

How to create an access database programatically in C#
I have created access databases in VB6, but now I am working in C#. I am trying to create a Microsoft Access Database programatically in C#, but can't figure out how to do it. Can anyone give me any pointers? You'll probably have more luck asking in a C# newsgroup. Most of us here work from within Access, not from outside it. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Brian Kitt" <BrianKitt@discussions.microsoft.com> wrote in message news:34A1AD65-1C1D-4000-83F1-17FD907027EB@microsoft.com... >I have created access d...

Powerpoint Viewer 2007
How can I get rid of the black, Esc to Exit screen in Viewer 2007. I need to run this from a kiosk, and don't want people to have to hit Esc. It works fine within PPT, as I have clicked to turn the black screen off. I would think Viewer would use the settings within the slideshow. Fran Turning off the black screen only works on your PC, it won't follow the presentation even in the full program. In Kiosk mode you shouldn't ever see the black screen AFAIK so it may work fine anyway. -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www....

Reveal Codes
Having used WordPerfect for many years, we are now beginning to use Word. In WP, there was a feature that allowed you to see all formatting codes called Reveal Codes. Is there a similar feature in Word? Thanks. In which version of Word? For example: In Word 2002/2003 > Format > Reveal Formatting With fond memories of WordPerfect 5.1 for DOS, Daddy "DJT" <DJT@discussions.microsoft.com> wrote in message news:DFC1B95B-1C81-43FA-A128-49140ACF7A15@microsoft.com... > Having used WordPerfect for many years, we are now beginning to use Word. > In &...

Access 2007 UI QAT
I'm trying to control the order (left to right) of the buttons on my QAT. Interestingly, they do not appear in the order of the XML commands. Any Suggestions? Thanks, Fred Here's my code in USysRibbons: <mso:customUI xmlns:mso="http://schemas.microsoft.com/office/2006/01/customui"> <mso:ribbon startFromScratch="true" > <mso:qat> <mso:sharedControls> <mso:control idQ="mso:FilePrintPreview" visible="true"/> <mso:control idQ="mso:PrintPreviewClose" visible="true"/> ...