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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Problem

Status
Not open for further replies.

MFrancis

Technical User
Joined
Jan 25, 2002
Messages
6
Location
US
Can someone please help, I am soso with Access.
I am having trouble with dates in my query.
I have:
Reg Date
Name
SS#
Company Name
Address
Amount Billed
Date Billed
I would like to have another column that will give me a date if the bill is overdue by 30-60-90 days.
Ex: date: 03-01-02
Date billed: 03-02-02
30 Day due/send out bill: 4-02-02
Can this be done and could you please please explain in detail. I thank you so much
 
I would create a VBA function in an Access module to determine the which period the bill due date falls in. Here is a sample. You can modify for your needs. You may want the function to return a numeric value or a diffeeerent result for each period.

Function fn30_60_90_Days(dDate As String) As String
Dim iDays
iDays = DateDiff("d", dDate, Date)
If iDays >= 90 Then
fn30_60_90_Days = "90 Days"
ElseIf iDays >= 60 Then
fn30_60_90_Days = "60 Days"
ElseIf iDays >= 30 Then
fn30_60_90_Days = "30 Days"
Else
fn30_60_90_Days = "1-29 Days"
End If

End Function

Yoiu can use the function in a query, on a form, report, in another module. Here is an example of the function in a query.

Select *,
fn30_60_90_Days([Bill Date]) As PastDue
From YourTable Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Thank you so very much for your help, I will try it now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top