reference a function Please help!

G

Guest

my function looks is as follows... How do I use that funtion in a query?

Public Function Holidays(BeginDate As Date, EndDate As Date) As Integer
Holidays = DCount("*", "Holiday", "HdyDate Between " & _
Format$(BeginDate, "\#mm\/dd\/yyyy\#") & _
" And " & Format$(EndDate, "\#mm\/dd\/yyyy\#") & _
" And Weekday(HdyDate, 1) <> 1 " & " And Weekday(HdyDate, 1) <> 7 ")

End Function
 
J

Jeff Boyce

Open a query in design mode.

Enter the following in one of the empty field "cells"
=Holidays([YourBeginDateFieldName], [YourEndDateFieldName])
and <tab> out of the cell.

Access will add "Expr1:" in front of your expression -- feel free to change
this descriptive title of the field.

Regards

Jeff Boyce
<Office/Access MVP>
 
G

Guest

Thanks alot, that worked perfect

Jeff Boyce said:
Open a query in design mode.

Enter the following in one of the empty field "cells"
=Holidays([YourBeginDateFieldName], [YourEndDateFieldName])
and <tab> out of the cell.

Access will add "Expr1:" in front of your expression -- feel free to change
this descriptive title of the field.

Regards

Jeff Boyce
<Office/Access MVP>

JOM said:
my function looks is as follows... How do I use that funtion in a query?

Public Function Holidays(BeginDate As Date, EndDate As Date) As Integer
Holidays = DCount("*", "Holiday", "HdyDate Between " & _
Format$(BeginDate, "\#mm\/dd\/yyyy\#") & _
" And " & Format$(EndDate, "\#mm\/dd\/yyyy\#") & _
" And Weekday(HdyDate, 1) <> 1 " & " And Weekday(HdyDate, 1) <> 7 ")

End Function
 

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

Top