If Then Else statment Help

S

Stockwell43

Hello,

I have a Module named "NumWeekdays" which take out the weekends between two
dates, works fine. I have an "OriginalDate", "CompleteDate", "CurrentDate"
and "Text77" fields.

On the current record the user will always enter an Original Date. On a
report I want to show the elapsed time between the Original Date each day the
report is pulled (or how ever often is pulled) until a Complete Date is
filled in. What I would like to happen is this:

When the original date is inputted and the CompleteDate is blank, I want
Text77 to show the elasped days between the OriginalDate and CurrentDate. If
the CompleteDate is filled in, I want Text77 to show the elapsed time between
OriginalDate and CompleteDate.

I know this is not correct because it doesn't work but, this is where I was
going:

Private Sub Form_Current()
CurrentDate = Date
If Me.CompleteDate = "IsNull" Then
Me.Text77 = NumWeekdays([OriginalDate], [CurrentDate])
ElseIf IsNull(Me.CompleteDate) = "False" Then
Me.Text77 = NumWeekdays([OriginalDate], [CompleteDate])
Else

End If

End Sub

Any help would be very much appreciated!!!

Thanks!!!
 
C

Clif McIrvin

You had:
If Me.CompleteDate = "IsNull" Then

how about:

If IsNull(Me.CompleteDate) Then

???
--
Clif
Still learning Access 2003




Stockwell43 said:
Hello,

I have a Module named "NumWeekdays" which take out the weekends
between two
dates, works fine. I have an "OriginalDate", "CompleteDate",
"CurrentDate"
and "Text77" fields.

On the current record the user will always enter an Original Date. On
a
report I want to show the elapsed time between the Original Date each
day the
report is pulled (or how ever often is pulled) until a Complete Date
is
filled in. What I would like to happen is this:

When the original date is inputted and the CompleteDate is blank, I
want
Text77 to show the elasped days between the OriginalDate and
CurrentDate. If
the CompleteDate is filled in, I want Text77 to show the elapsed time
between
OriginalDate and CompleteDate.

I know this is not correct because it doesn't work but, this is where
I was
going:

Private Sub Form_Current()
CurrentDate = Date
If Me.CompleteDate = "IsNull" Then
Me.Text77 = NumWeekdays([OriginalDate], [CurrentDate])
ElseIf IsNull(Me.CompleteDate) = "False" Then
Me.Text77 = NumWeekdays([OriginalDate], [CompleteDate])
Else

End If

End Sub

Any help would be very much appreciated!!!

Thanks!!!
 
C

Clif McIrvin

I forgot to add, change:
ElseIf IsNull(Me.CompleteDate) = "False" Then

to Else

--
Clif
Still learning Access 2003



Stockwell43 said:
Hello,

I have a Module named "NumWeekdays" which take out the weekends
between two
dates, works fine. I have an "OriginalDate", "CompleteDate",
"CurrentDate"
and "Text77" fields.

On the current record the user will always enter an Original Date. On
a
report I want to show the elapsed time between the Original Date each
day the
report is pulled (or how ever often is pulled) until a Complete Date
is
filled in. What I would like to happen is this:

When the original date is inputted and the CompleteDate is blank, I
want
Text77 to show the elasped days between the OriginalDate and
CurrentDate. If
the CompleteDate is filled in, I want Text77 to show the elapsed time
between
OriginalDate and CompleteDate.

I know this is not correct because it doesn't work but, this is where
I was
going:

Private Sub Form_Current()
CurrentDate = Date
If Me.CompleteDate = "IsNull" Then
Me.Text77 = NumWeekdays([OriginalDate], [CurrentDate])
ElseIf IsNull(Me.CompleteDate) = "False" Then
Me.Text77 = NumWeekdays([OriginalDate], [CompleteDate])
Else

End If

End Sub

Any help would be very much appreciated!!!

Thanks!!!
 
S

Stockwell43

Hi Clif,

That seemed to work and so far everything works as I need it to.

Thank you for your help!!!

Clif McIrvin said:
You had:
If Me.CompleteDate = "IsNull" Then

how about:

If IsNull(Me.CompleteDate) Then

???
--
Clif
Still learning Access 2003




Stockwell43 said:
Hello,

I have a Module named "NumWeekdays" which take out the weekends
between two
dates, works fine. I have an "OriginalDate", "CompleteDate",
"CurrentDate"
and "Text77" fields.

On the current record the user will always enter an Original Date. On
a
report I want to show the elapsed time between the Original Date each
day the
report is pulled (or how ever often is pulled) until a Complete Date
is
filled in. What I would like to happen is this:

When the original date is inputted and the CompleteDate is blank, I
want
Text77 to show the elasped days between the OriginalDate and
CurrentDate. If
the CompleteDate is filled in, I want Text77 to show the elapsed time
between
OriginalDate and CompleteDate.

I know this is not correct because it doesn't work but, this is where
I was
going:

Private Sub Form_Current()
CurrentDate = Date
If Me.CompleteDate = "IsNull" Then
Me.Text77 = NumWeekdays([OriginalDate], [CurrentDate])
ElseIf IsNull(Me.CompleteDate) = "False" Then
Me.Text77 = NumWeekdays([OriginalDate], [CompleteDate])
Else

End If

End Sub

Any help would be very much appreciated!!!

Thanks!!!
 
C

Clif McIrvin

Stockwell43 said:
Hi Clif,

That seemed to work and so far everything works as I need it to.
Great!



Thank you for your help!!!

You're welcome.

--
Clif
Still learning Access 2003


Clif McIrvin said:
You had:
If Me.CompleteDate = "IsNull" Then

how about:

If IsNull(Me.CompleteDate) Then

???
--
Clif
Still learning Access 2003




message
Hello,

I have a Module named "NumWeekdays" which take out the weekends
between two
dates, works fine. I have an "OriginalDate", "CompleteDate",
"CurrentDate"
and "Text77" fields.

On the current record the user will always enter an Original Date.
On
a
report I want to show the elapsed time between the Original Date
each
day the
report is pulled (or how ever often is pulled) until a Complete
Date
is
filled in. What I would like to happen is this:

When the original date is inputted and the CompleteDate is blank, I
want
Text77 to show the elasped days between the OriginalDate and
CurrentDate. If
the CompleteDate is filled in, I want Text77 to show the elapsed
time
between
OriginalDate and CompleteDate.

I know this is not correct because it doesn't work but, this is
where
I was
going:

Private Sub Form_Current()
CurrentDate = Date
If Me.CompleteDate = "IsNull" Then
Me.Text77 = NumWeekdays([OriginalDate], [CurrentDate])
ElseIf IsNull(Me.CompleteDate) = "False" Then
Me.Text77 = NumWeekdays([OriginalDate], [CompleteDate])
Else

End If

End Sub

Any help would be very much appreciated!!!

Thanks!!!
 

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