Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with my Vba doesn't work

Status
Not open for further replies.

Aran10

Vendor
Mar 17, 2011
6
GB
I copied and pasted this Vba into access with my tables
I then made a query with the following functions

The date due expressions can then be calculated by:
- Creating a provisional date due field and using this expression:
Provisional Date Due: DateAdd("d",13,[Loan Date])
- Then create the Date Due field with this expression:
Date Due: NextWorkDay([Provisional Date Due])

SCENARIO
A book can be on loan for fourteen days. The due date is the Loan date plus fourteen days. If the Due date falls on a day when the school is closed (e.g. during a holiday period) then the Due date becomes the date that is after the holidays


I have the tables tblholidays and field holidate with each individual date that is a holiday but I get an error with the nextworkday function and it turns up yellow? The holidate field is date/time

How can I correct this?
 
Reviewing the Date Functions, it looks like you might have some formating issues. I would sugggest looking at the way LoanDate is handled when being called for the NextWorkDay function (Add Watch). You can use Format(LoanDate, ... ) to modify it as needed, and then again, take the output Format(NextWorkDay, ... ) to ensure that the table requirements are met.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top