error type mismatch vb6

getting an error "By reference mismatch" when trying to call this function:

Function DetermineNextTaskTime(dteTaskTime As Date) As String
Dim dteTaskTimeTom As Date
Dim dteTimeNow As Date
Dim lngDifference As Long
Dim lngHours As Long
Dim lngMinutes As Long

dteTimeNow = TimeValue(Now)
' This is set up for a 9AM task
'dteTaskTime = TimeValue("9:00") ' assumes military time
dteTaskTime = TimeValue(dteTaskTime) ' assumes military time

If dteTimeNow > dteTaskTime Then
    ' Format a date+time value that represents the task time tomorrow
    dteTaskTimeTom = Format(Now + 1, "short date") & " " & dteTaskTime
    lngDifference = Abs(DateDiff("s", dteTaskTimeTom, Now))
Else
    lngDifference = DateDiff("s", dteTimeNow, dteTaskTime)
    lngHours = (lngDifference \ 60) \ 60
    lngMinutes = (lngDifference - (lngHours * 60 * 60)) \ 60
End If

lngHours = (lngDifference \ 60) \ 60
lngMinutes = (lngDifference - (lngHours * 60 * 60)) \ 60
'MsgBox "Task due in " & lngHours & " Hours and " & lngMinutes & " Minutes"
DetermineNextTaskTime = lngHours & lngMinutes
End Function)

Open in new window


gNewTime = "09:00 AM"
 .TextMatrix(LastRow, mgrdNxtDueDate) = DetermineNextTaskTime(gNewTime

what is wrong ?
isnoend2001Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
quick fix, try:

Function DetermineNextTaskTime(ByVal dteTaskTime As Date) As String

or Declare variable gNewTime

Dim gNewTime As Date
gNewTime = "09:00 AM"
....

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isnoend2001Author Commented:
Thanks that byval worked
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.