I have a form that needs to have an If Then statement added into the code to make 0=1.
the code is as follows
Private Sub SequenceNo_AfterUpdate()
Dim MyDB As Database
Dim Rec As Recordset
Dim SQLString As String
SQLString = "SELECT tblChargeBack.SequenceNumber, DateDiff('d',[StartDate],[DateClosed]) AS Elapsed, ([Elapsed]*(0.06/365)*[Amount]) AS Total FROM tblChargeBack INNER JOIN tblCloseItem ON tblChargeBack.SequenceNumber = tblCloseItem.SequenceNo WHERE tblChargeBack.SequenceNumber ='" & SequenceNo & "'"
Set MyDB = CurrentDb()
Set Rec = MyDB.OpenRecordset(SQLString, dbOpenSnapshot)
InterestFee = Rec!Total
End Sub
There are two dates that make the [Elapsed] but some times the two dates are the same. In that case I get an error. Where in the code would I put the statement,
IF([Elapsed]=0,"1","[Elapsed]"
, I am not sure if the statement is correct either. I am on access 2000 if that helps.
Thanks
Kenny
the code is as follows
Private Sub SequenceNo_AfterUpdate()
Dim MyDB As Database
Dim Rec As Recordset
Dim SQLString As String
SQLString = "SELECT tblChargeBack.SequenceNumber, DateDiff('d',[StartDate],[DateClosed]) AS Elapsed, ([Elapsed]*(0.06/365)*[Amount]) AS Total FROM tblChargeBack INNER JOIN tblCloseItem ON tblChargeBack.SequenceNumber = tblCloseItem.SequenceNo WHERE tblChargeBack.SequenceNumber ='" & SequenceNo & "'"
Set MyDB = CurrentDb()
Set Rec = MyDB.OpenRecordset(SQLString, dbOpenSnapshot)
InterestFee = Rec!Total
End Sub
There are two dates that make the [Elapsed] but some times the two dates are the same. In that case I get an error. Where in the code would I put the statement,
IF([Elapsed]=0,"1","[Elapsed]"
, I am not sure if the statement is correct either. I am on access 2000 if that helps.
Thanks
Kenny