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
Medium Priority
479 Views
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
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
• 3
• 2

LVL 8

Accepted Solution

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

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

ID: 1446370
0

LVL 8

Expert Comment

ID: 1446371
0

LVL 8

Expert Comment

ID: 1446372
Thanks.
0

## Featured Post

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
Course of the Month9 days, 23 hours left to enroll