Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Invoice Total VB Function

Posted on 1997-12-20
5
Medium Priority
?
479 Views
Last Modified: 2010-05-18
I would like to create a function in VB.  I never wrote or used functions before.  Here is the situation:
I have two tables:  Invoice table & Account Receivables Table. Here are the fields:
Invoice Table:  Invoice#, Date,(all customer Info fields), Total Labor.
A/R Table: Invoice#, Date, (all customer Info fields), Late Charge, Amount Paid.

I would like to have a Function to calculate the Total Invoice Balance so I can put it in several forms.  
Here is the calculation:

([Invoice table]![Total Labor])+([Account Receivables Table]![Late Charges])-([Account Receivables Table]![Amount Paid])

I have no idea how to do this.  Any help will be appreciated.

Thanks!!

Alexander!!!

0
Comment
Question by:Millos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
mrmick earned 240 total points
ID: 1446368
Function InvoiceTotal() As Long

   InvoiceTotal = ([Invoice table]![Total Labor]) + ([Account Receivables Table]![Late Charges]) - ([Account Receivables Table]![Amount Paid])

End Function

Usage:
Debug.Print InvoiceTotal

This will print the Invoice total for the current record.
0
 

Author Comment

by:Millos
ID: 1446369
mrmick: Thanks.. I tried creating the function (Which is the first time) and get an Invalid Object Reference in the following line (Tables!([Invoice table]![Total Labor]) and it highlights ([Invoice Table]

That is the correct name of the invoice table.  Do I have to declare the DB I am using?
Thanks!!
Alexander!!
   
Agongora@voicenet.com


0
 

Author Comment

by:Millos
ID: 1446370
Adjusted points to 60
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1446371
Millos, If you're now satisfied with the answer you've received - you should grade it.
0
 
LVL 8

Expert Comment

by:mrmick
ID: 1446372
Thanks.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question