473,382 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Need direction

I have a headache am trying to solve I hope someone helps me with this one. I have a code which autopopulate dates based on a selection criteria. What I want to is that it should skip all weekends whiles it populates the fields. I have tried the Weekend functions but it simply does not work. am hoping that someone helps me out. this is my code
Expand|Select|Wrap|Line Numbers
  1. If MsgBox("Are you SURE? This will erase all payment data and create a new schedule?", vbYesNoCancel + vbCritical, "Falcon Engine") <> vbYes Then Exit Sub
  2.  
  3.     If IsNull(Forms!LoanF!PaymentAmount) Then
  4.         MsgBox "You need to calculate the payment amount first"
  5.         Exit Sub
  6.     End If
  7.  
  8.     DoCmd.SetWarnings False
  9.  
  10.     DoCmd.RunSQL ("DELETE * FROM ScheduleT WHERE LoanID=" & Forms!LoanF!LoanID)
  11.     Me.Requery
  12.     DoCmd.GoToControl "PaymentNumber"
  13.  
  14.     Dim BBal As Currency
  15.     Dim Counter As Long
  16.     Dim CurDate As Date
  17.     Dim X As Integer
  18.     Dim TotalPrin As Currency, Correction As Currency
  19.  
  20.     BBal = Forms!LoanF!TotalAmountDue
  21.     Counter = 1
  22.     CurDate = Forms!LoanF!FirstPaymentDate
  23.  
  24.     While BBal > 0
  25.         DoCmd.GoToRecord , , acNewRec
  26.         PaymentNumber = Counter
  27.         [ClientName] = Forms!LoanF!ClientName
  28.         [AccountNumber] = Forms!LoanF!AccountNumber
  29.         Counter = Counter + 1
  30.         DueDate = CurDate
  31.         CurDate = IIf(Forms!LoanF!RepaymentFrequency = "Daily", (DateAdd("d", 1, CurDate)), IIf(Forms!LoanF!RepaymentFrequency = "Weekly", DateAdd("ww", 1, CurDate), IIf(Forms!LoanF!RepaymentFrequency = "Fortnightly", DateAdd("ww", 2, CurDate), IIf(Forms!LoanF!RepaymentFrequency = "Monthly", DateAdd("m", 1, CurDate), IIf(Forms!LoanF!RepaymentFrequency = "Quarterly", DateAdd("q", 1, CurDate), IIf(Forms!LoanF!RepaymentFrequency = "Semi Annually", DateAdd("yyyy", 1, CurDate) / 2, IIf(Forms!LoanF!RepaymentFrequency = "Yearly", DateAdd("yyyy", 1, CurDate), "Invalid Reapayment Frequency")))))))
  32.         AmountPaid = 0
  33.         InterestPaid = (Forms!LoanF!TotalAmountDue - Forms!LoanF!Principal) / (Forms!LoanF!TotalAmountDue) * AmountPaid
  34.         PrincipalPaid = AmountPaid - InterestPaid
  35.         RegularPayment = 0
  36.         ExtraPayment = 0
  37.         Penalty = 0
  38.         BeginningBalance = BBal
  39.         AmountDue = Forms!LoanF!PaymentAmount
  40.         InterestDue = Round(BeginningBalance * ((Forms!LoanF!InterestPerMonth) / (Forms!LoanF!NumberOfPayments)), 2)
  41.         PrincipalDue = AmountDue - InterestDue
  42.         If BBal < Forms!LoanF!PaymentAmount Then
  43.             EndingBalance = 0
  44.             AmountDue = AmountDue
  45.             PrincipalDue = PrincipalDue
  46.         Else
  47.             EndingBalance = BeginningBalance - AmountDue
  48.  
  49.         End If
  50.  
  51.         BBal = EndingBalance
  52.     Wend
  53.  
  54.     DoCmd.GoToRecord , , acNewRec
  55.  
  56.     Forms!LoanF.Requery
  57.     DoCmd.SetWarnings True
  58.  
Every thing is fine with the exception of weekends included in the DUEDATE. Please i need help.

I seems to be asking more questions because I have not even stepped in a programming class before!
Oct 23 '13 #1
3 840
zmbd
5,501 Expert Mod 4TB
yashuaking
Please, new question, new thread - we respectfully ask that each thread be kept to a single question. This makes it easier to stay focused on the goal and for others with a similar problem to find the help they need.
I’ve gone ahead and split this out to a new thread for that reason; however, the title is somewhat generic and can be changed should you desire.
Oct 24 '13 #2
Ok thanks Zmbd. I would do well to comply to the guidelines
Oct 24 '13 #3
But please I need help with the post
Oct 24 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Oren | last post by:
Hi all I really need direction in this one I have a WinApp in C# and I need to load data at the beginning and save data o exit - just simple things like: this.Top, this.Left etc.. I have...
1
by: Glen | last post by:
I need to make a project for school that intergrates Frontpage, access, word and powerpoint. I wanted to make something that would be usefull for work also. Anyways, here goes. I hope to create...
1
by: Celia Oblinger | last post by:
Please understand that I am not asking HOW to do something - but, rather, I just need some advise on what "technology" or method I should employ... The problem is this: I have a client for...
3
by: Raj | last post by:
Hi All, Currently, i'm working in VC++. We are having a migration project in ..net. I'm very much interested to work in C# and planning to write certification program in web applications. I'm not...
1
by: simonalexander | last post by:
I have got a homework task to do and I have started the work but I cannot finish it.Can someone please help me finish the code. The help given is much appreciated. The actual specifications are...
17
by: Remington | last post by:
Back again, thirsting for knowlege. :) http://www.thescripts.com/forum/showthread.php?p=2314976#post2314976 Was my last thread. I am still working on the same project, but a different stage. I...
0
by: suppyzw | last post by:
Hello everyone I have to impliment a new barcode system in a warehouse. Meaning i have to replace pre-existing sacnners and the middleware that feeds into a SQL database. The Wifi coverage...
1
by: suppyzw | last post by:
Hello everyone I have to impliment a new barcode system in a warehouse. Meaning i have to replace pre-existing sacnners and the middleware that feeds into a SQL database. The Wifi coverage...
5
by: Sathya9999 | last post by:
Hello, I am new to db2 Administration.. Need guidance from you guys.. Is there any list of command we come accros day to day life.. and any documentation, I have most of DB2 site docuements.....
1
by: santus | last post by:
Hello, I've just join this forum and i need help about using matlab function from .net. I need to make a program to plot data into 2D graphics and the program use use mathematics functions. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.