Hi,
This website is great, I can't seem to figure out one thing. I have a lease database and I want to calculate the invoice month on the fly in a form, this is the code at the moment
=DateAdd("m",Nz ([FREQUENCY],0),Nz([START_LEASE],0))
But it doesn't keep recurring to give me a date of 2008.
An example of a record:-
Start Lease Date - As a Date (15/07/1983)
Frequency of Payment - In Months (12)
So I want to output the invoice month (date), calculated from the two fields essentially I would want this date (15/07/2008) in the invoice month field
Hope this all makes sense, and it's probably really easy, but I'm stuck. Little help please. Many Thanks
Caze
7 1985 NeoPa 32,579
Recognized Expert Moderator MVP
Unfortunately it's not clear from what you have already what it is you want.
Your current expression will add simply the number of months in Frequency to your start date. Using your example this will always return 15/7/1984. Regardless of the current date.
The Nz([START_LEASE],0) is also a problem. This will then assume the Lease started on the base date for Access dates (probably sometime around 1900). Not useful for you.
What is the date you want to show? Last payment date (the one before current date) or next one (after today)?
At the moment it's working as you said, but I want to get the next invoice date after today.
If a lease started today and the payment was due 12 months from today, my function would work correctly as it would give me next years date in 2009. Let's say it was a five year lease, how would I make it reccur for the next year and the 4 years after that?
Example: A lease started in 15/07/1995 and they paid anually, I would want the invoice date to show 15/07/2008.
NeoPa 32,579
Recognized Expert Moderator MVP
Although this is possible to do in a formula (=...) as you have it, it's very complicated and this sort of logic lends itself better to coding in VBA. - =NextInv([START_LEASE], [FREQUENCY]) As Date
In the module for your form (or, if this is not in a form, add it to a standard module) include : - Public Function NextInv(varStart as Variant, varFrequency as Variant) As Date
-
Dim datNext As Date
-
-
...
-
End Function
Funny place to stop I know :( But I need to reboot my computer and go out.
Please tell me what you want to do if [START_LEASE] is Null.
When I have this info I can return to this and complete the code.
Hi, thanks for helping me figure this one out. This Payment date is being done in a form and in MS Access 2000.
If the [START_LEASE] and the [FREQUENCY] is null, I would want a blank field for the payment date. If either of those is null I would want the Payment Date to be blank also.
So if I had a 5 year lease, the [START_LEASE] would be let's say (15/07/2003) and [FREQUENCY] of payment was (12months), I would want it to do iterations of (12months) per year and show me the next payment date of (15/07/2008)
Thanks in advance!
Caze
NeoPa 32,579
Recognized Expert Moderator MVP
Cheers for that.
I hope to catch up with things soon (weekend maybe) and I feel this is all here to work with :)
How would you deal with a record where only one or other field is Null though (not both)?
1 answer for Date & 1 for Frequency please ;)
Hello,
1. If [START_LEASE] is null then [INVOICE_MONTH] is blank
2. If [FREQUENCY] is null then [INVOICE_MONTH] is blank
The Payment date is dependant on both fields being entered.
Where one field is null then the payment date should be empty/blank.
Have a good weekend!
Thanks again
Caze
NeoPa 32,579
Recognized Expert Moderator MVP
Try this then. - Public Function NextInv(ByVal varStart as Variant,
-
ByVal varFrequency as Variant) As Variant
-
If IsNull(varFrequency) Or IsNull(varStart) Then
-
NextInv = Null
-
Exit Function
-
End If
-
NextInv = CDate(varStart)
-
Do While NextInv < Date()
-
NextInv = DateAdd("m", varFrequency, NextInv)
-
Loop
-
End Function
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: David B |
last post by:
I am creating invoices for an app I am busy with.
The transactions for the invoice come from 2 tables which store Sales and
Facilities Hire.
The current arrangement is that I create a temp table using append queries to
get transactions from the 2 tables between selected dates. then draw these into
a report grouped by the Sales and Facilities Hire
This all works fine.
However the customer requires invoices (reports) to have consecutive...
|
by: Burghew |
last post by:
Hi all,
I need to take montly invoices for all the work orders completed (based on
DateCompleted) from my tranaction table. Please can anyone suggest a way to
avoid charging the customers again for the subsequent months when I take the
invoice for the next month (exclude all the records for which I have already
invoiced for the previous month if work IsNotNull(datecompleted). Any tips
on how to improve invoicing on a montly basis. TIA
...
|
by: NomoreSpam4Me |
last post by:
Hi there i have a little problem with my invoice.
Here it is:
i have a main menu with buttons, one of my button is "Create new
invoice", when click on it a form pop up so i can enter my information
and one of the field (the user cannot change the info in it.) is
invoice #. Right now, everythime i click on "Create new invoice", the
invoice # add 1. But my problem is sometime the employee dont fill it
(for x reason) and shut it down,...
|
by: Guoqi Zheng |
last post by:
Dear sir,
Our E-commerce site needs to print out a few 100s invoice a day. I do not
know what is the best way to print invoice. Those invoice has to be printed
on a very precise position on our invoice format paper.
I am thinking about the following to print the invoice.
1. Ms Access Report.
2. ASP.NET web form.
|
by: Herman Beeksma |
last post by:
Hi there! I have two tables:
Customer (ID, Name)
Invoice (ID, Date, Customer, Amount)
and want to select only the *last* invoice for each customer. It's easy
to get each customer's last invoice date:
SELECT Customer.Name, MAX(Invoice.Date)
FROM Customer INNER JOIN Invoice ON Custimer.ID = Invoice.Customer
| |
by: yellowarmy |
last post by:
Theres two problems i have.
1) Theres a question i have to answer in a mock is that the company does invoices every month but i need it for to select invoice and then select the month whcih would then give you the invoices for the selected month.
2) The first is adding the number of outstanding invoices in the report footer in the Invoice. I use this text box = IIf(Min()<Date()-30,"Please Pay Up","") to calcualte if the invoice had been...
|
by: eyalco |
last post by:
I'm building a receipt/invoice database - I've started with the invoice first, then the receipt.
I have invoice = parents and sons + receipt = parents and sons tables + a customer table.
I want to issue 1 receipt with 12 payments (1 check for each month of the year) and then, everytime a check comes to delivery, the invoice is printed out with the receipt number.
What would be the relation between the receipt/invoice tables and how do I...
|
by: gazza10001 |
last post by:
Hi
i hope you can help my company uses access and has modified for its needs usually what happens is you serach for the invoice by its number and then it brings all the information up such as entry fields and so there is a button you press which then takes to through to a print preview of the invoice and you print out the invoice but recent ly this message ahs started appearing and does not allow you to view the print preview of the invoice...
|
by: tasawer |
last post by:
Hi,
I am looking for guidelines to create a monthly recurring invoice using the following criteria.
We manage vehicles for Rental companies and therefore we require to invoice same amount each month. (monthly fee is based on 28-day month)
Invoice report must show vehicle reg, date vehicle acquired (or discharged) and management fee for each vehicle,
at the moment we have a set number of vehicles to manage but in future, a new vehicle...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |