Date turn time calculation HELP PLEASE!

S

Stockwell43

Hello,

I have a some what messed up situation and hoppe someone out here can help.

On my database form I have several date field but I only need three to work
in a turnaround time. Here's what I have:

Executed Scan Date, Funding Date and Original Docs Received Date. I need to
create a turnaround time using these three dates and am not sure if it can be
done. Current;y I have the Funding Date as the beginning date and the
Original Receive Date as the end date and it works great. Here's what I need:

The Original docs Received Date will stay as the end date. So I have a
couple of different scenerios.
1. If Executed Scan OR Funding is filled in subract from Original Rec. Date.
So I need a way to tell Access to subtract which of the two is completed from
Original Rec. Date.

2. If both Executed Scan AND Funding Date are completed, then I need a way
to tell Access to Subtract which of the two is earlier and subtract that one
from the Original Rec. Date. So if Execute Scan date is 02/01/08 and Funding
Date is 02/03/08, then I need for access to subtract Executed Scan Date
02/01/08 from Original Rec. Date because it is the older one. Does this make
sense?

I offered to place another turnaround time field with a calculate button on
the form but they don't want to junk the form up any more and I agree so I am
turning to you folks for help. If this is possible please simplify answer.

Thanks You!!
 
P

Pat Hartman

Here is some psuedo code to get you going.

Dim dte1 as datetime
Dim dte2 as datetime
Dim dte3 as datetime
Dim daysDiff as integer
If IsDate(Me.ScanDate) Then
dte1 = Me.ScanDate
Else
dte1 = #1/1/1900#
End If
If IsDate(Me.FundingDate) Then
dte2 = Me.FundingDate
Else
dte2 = #1/1/1900#
End If
If dte1 < dte2 Then
dte3 = dte1
Else
dte3 = dte2
End If
If dte3 = #1/1/1900# Then
msgbox "both dates were null", vbokonly
daysDiff = 0
Else
daysDiff = DateDiff("d",Me.DocRecDate, dte3)
End If
 
S

Stockwell43

Hi Pat and thank you for replying.

When I put the code in my cmdButton I get a compile error when I try to run
the code. It says "Automation Type is not Supported in Visual Basic" Did I do
something wrong?
 
P

Pat Hartman

If you post your code, we can take a look at it.

Stockwell43 said:
Hi Pat and thank you for replying.

When I put the code in my cmdButton I get a compile error when I try to
run
the code. It says "Automation Type is not Supported in Visual Basic" Did I
do
something wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top