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

User defined functions 2

Status
Not open for further replies.

jpl458

Technical User
Sep 30, 2009
337
US
Had a small app in Access 2007 that used the following that I created:

Option Compare Database

Function stripDate(blah As Date) As Date


stripDate = Format(blah, "hh:mm:ss")

End Function

Lost disk, and small ap, but had back up the function in word. They upgraded my pc, got Office 2010 Pro.

Recreated the ap, added the function, but now when ever I run a query that used the function I get Undefined funcution 'stripDate'in expression.

In the qbe grid the expression is: TranTime: stripDate([dbo_Transaction_Table]![Time_of_Transaction])

Tried all sort of permutations, and looked in the web, but stumped.

Thanks in advance.

jpl

 
How are ya jpl458 . . .

Make sure the function resides in a standard module (module in the modules window) and is preceded by the word [blue]Public[/blue].
Code:
[blue][purple][b]Public[/b][/purple] Function stripDate(blah As Date) As Date
   stripDate = Format(blah, "hh:mm:ss")
End Function[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Pasted your code into function in module and got the same result. Still stumped:

Public Function stripDate(blah As Date) As Date
stripDate = Format(blah, "hh:mm:ss")
End Function
 
jpl458 . . .

Post the sql of the query containing the function ...

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Did you save the module with the same name as the function? that's why we recommend using naming conventions. You can strip the date portion with:
Code:
stripDate = TimeValue([date and time])

Duane
Hook'D on Access
MS Access MVP
 
Yes, I saved the function with the same name as the function, is that a problem? I thought I tried renaming the function in one of many attempts. But, I will try it again. Just tried it and it worked. Thanks for the quick response.

jpl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top