>I am actually testing for Monday. The issue with the variable got resolved
> but I got a new issue. I am not able to export the report to the
> location.
> I get error mssg saying that "MS access can't save the output data to the
> file you selected" .
>
> The value to the export location is H:\Full Individual
> Audit_11/18/2008.rtf.
>
> I appreciate your help.
>
> Thanks.
>
> "Douglas J. Steele" wrote:
>
>> Variables declared in functions are not available outside of the
>> function.
>>
>> Private Function OfficeClosed(TheDate) As Date
>>
>> ' Test for Saturday or Sunday.
>> If Weekday(TheDate) = 2 Then
>> OfficeClosed = Date - 1
>> Else
>> OfficeClosed = Date
>> End If
>>
>> End Function
>>
>> To use:
>>
>> exportlocation.Value = RPath & rptNam & "_" & OfficeClosed(Date) &
>> ".rtf"
>>
>>
>> Incidentally, your comment says you're testing for Saturday or Sunday,
>> but
>> in fact you're testing for Monday. Which is the error?
>>
>> --
>> Doug Steele, Microsoft Access MVP
>>
http://I.Am/DougSteele>> (no e-mails, please!)
>>
>>
>> "Shri" <Shri[ at ]discussions.microsoft.com> wrote in message
>> news:6F639091-2638-42F8-AE66-3B2569C226B6[ at ]microsoft.com...
>> > Hi,
>> >
>> > I have a below function in a form.
>> >
>> > ****
>> > Private Function OfficeClosed(TheDate) As Integer
>> >
>> > Dim Date_export As Date
>> >
>> > OfficeClosed = False
>> >
>> > ' Test for Saturday or Sunday.
>> > If Weekday(TheDate) = 2 Then
>> > OfficeClosed = True
>> > Date_export = Date - 1
>> > Else
>> > Date_export = Date
>> > End If
>> >
>> > End Function
>> >
>> > ****
>> >
>> > I need to use the variable "Date_export" defined above in a sub
>> > procedure.
>> > I have below two lines of code in a sub proc. But the code doesn't
>> > work.
>> >
>> > ****
>> > Call OfficeClosed(Date)
>> > exportlocation.Value = RPath & rptNam & "_" & Date_export & ".rtf"
>> > ******
>> >
>> > The date is not displayed in the field "exportlocation". I would
>> > appreciate
>> > any help on this.
>> >
>> > Thanks.
>> >
>>
>>
>>