Problem with Fuction information

S

scott04

Hi everyone,
I have been asked to calculate turntime for a database that i did not
create. Here are the names of the fields:
Date/Time of Call
Date Processed

My problem is that these fields contain spaces rather than underscores.
When I type in Public Function Workingdays2(Date/Time of Call As Date, Date
Processed As Date) As Integer i received a compile error regarding a list
separator. How would i type a field that has spaces? I always name my
fields with underscores to avoid this problem but how can i get around this
and name the field. Thanks for your help.
 
D

Douglas J. Steele

The name of the parameters in your function has no bearing on the names of
the fields being passed to the function.

You can use

Public Function Workingdays2(CallDate As Date, ProcessedDate As Date) As
Integer

and use CallDate and ProcessedDate everywhere in your function.

To use the function, you'd call

Function([Date/Time of Call], [Date Processed])

Note, though, that if either of the fields are Null, your function will
fail, You may be best off doing something like:

Public Function Workingdays2(CallDate As Variant, ProcessedDate As Variant)
As Integer

If IsNull(CallDate) Or IsNull(ProcessedDate) Then
Workingdays2 = 0
Else

' Put the rest of the code here

End If

End Function
 
S

scott04

Thanks Doug

Douglas J. Steele said:
The name of the parameters in your function has no bearing on the names of
the fields being passed to the function.

You can use

Public Function Workingdays2(CallDate As Date, ProcessedDate As Date) As
Integer

and use CallDate and ProcessedDate everywhere in your function.

To use the function, you'd call

Function([Date/Time of Call], [Date Processed])

Note, though, that if either of the fields are Null, your function will
fail, You may be best off doing something like:

Public Function Workingdays2(CallDate As Variant, ProcessedDate As Variant)
As Integer

If IsNull(CallDate) Or IsNull(ProcessedDate) Then
Workingdays2 = 0
Else

' Put the rest of the code here

End If

End Function


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scott04 said:
Hi everyone,
I have been asked to calculate turntime for a database that i did not
create. Here are the names of the fields:
Date/Time of Call
Date Processed

My problem is that these fields contain spaces rather than underscores.
When I type in Public Function Workingdays2(Date/Time of Call As Date,
Date
Processed As Date) As Integer i received a compile error regarding a list
separator. How would i type a field that has spaces? I always name my
fields with underscores to avoid this problem but how can i get around
this
and name the field. Thanks for your help.
 

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