|
-
Mar 8th, 2007, 01:04 PM
#1
Thread Starter
New Member
unknow behaviour
anybdy pls help me i desparately wana hel
i have a simple code block where i have one varaible which i use to display value in a label, the prob is that when i put in a break stament anywhere in the code it displays one value but when i remove the break point it shows another value (without even changing a single line of code) ........... can anybdy suggest some remedy my project is hanging bcz of this prob...
Last edited by mubashirkhan; Mar 8th, 2007 at 01:54 PM.
Reason: no response
-
Mar 8th, 2007, 01:07 PM
#2
Hyperactive Member
Re: unknow behaviour
Can you post your code plz
-
Mar 8th, 2007, 01:08 PM
#3
Re: unknow behaviour
Show us the code and point out where you are placing your break.
-
Mar 8th, 2007, 01:14 PM
#4
Thread Starter
New Member
Re: unknow behaviour
Private Sub findcheques()
cheque1 = False
cheque2 = False
If rs_cheques.RecordCount <> 0 Then
If Not IsNull(rs_cheques!chequeno1) Then
Text1 = rs_cheques!chequeno1
DTPicker1.Value = rs_cheques!chequedate1
Text4 = rs_cheques!chequeamt1
Text1.Enabled = False
prevmoretorium = rs_cheques!chequemoretorium1
prevmoretoriumdays = rs_cheques!moretoriumdays1
DTPicker1.Enabled = False
Text4.Enabled = False
cheque1 = True
'check if next quarter was included in the moretorium
appqtr = rs_cheques!appendqtr
End If
If Not IsNull(rs_cheques!chequeno2) Then
Text2 = rs_cheques!chequeno2
DTPicker2.Value = rs_cheques!chequedate2
Text5 = rs_cheques!chequeamt2
Text2.Enabled = False
DTPicker2.Enabled = False
Text5.Enabled = False
cheque2 = True
End If
End If
rs_clients.FindFirst "clientid=" & clientcode
If rs_clients.NoMatch = False Then
roi = rs_clients!schemeroi
noq = rs_clients!schemeduration
schmargin = rs_clients!schememargin
amtsanctioned = rs_clients!clientamountsanctioned
End If
End Sub
Private Sub enabletexts()
Text1.Enabled = True
Text1.Text = ""
......
End Sub
Private Sub Text5_Validate(Cancel As Boolean)
If IsNumeric(Text5.Text) Then
If DTPicker2.Value >= DTPicker1.Value Then
recalculate
quarterdifference
findamountpaid
calculatemoretorium
calculateinterest
'function is called here
calculatebalance
Frame2.Visible = True
showvalues
Command1.Enabled = True
Text2.Enabled = False
DTPicker2.Enabled = False
Text5.Enabled = False
Else
MsgBox "Check 2 date cannot be less than Check 1 date"
DTPicker2.SetFocus
End If
End If
End Sub
Private Sub Command1_Click()
checkfields
If errmsg <> "" Then
MsgBox errmsg
Else
If (cheque1 = True And cheque2 = False) Then
reupdatecheque
End If
updateclient
updatecheques
End If
Command1.Enabled = False
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub DTPicker1_Validate(Cancel As Boolean)
chqday = DTPicker1.Day
chqmonth = DTPicker1.Month
moretoriumperiod chqmonth, chqday
End Sub
Private Sub DTPicker2_Validate(Cancel As Boolean)
chqday = DTPicker2.Day
chqmonth = DTPicker2.Month
End Sub
Private Sub Form_Load()
connect2db
DTPicker1.Value = Date
DTPicker2.Value = Date
End Sub
Private Sub connect2db()
Set db2 = OpenDatabase(App.Path + "\swdc.mdb")
End Sub
Private Sub checkfields()
errmsg = ""
If cheque1 = False Then
If Text1.Text = "" Then
errmsg = errmsg + "Invalid Cheque No-1" + vbCrLf
End If
.....
End If
End Sub
Private Sub deductmargin()
cmargin = (amtsanctioned * (schmargin / 100))
cmargin = Round(cmargin)
newamount = CLng(Text4) - cmargin
End Sub
Private Sub moretoriumperiod(smonth As Integer, Days As Integer)
Select Case smonth
Case 1
moretoriumdays = 60 + (32 - Days)
chequemoretoriumdays QTR2
Case 2
moretoriumdays = 31 + (30 - Days)
chequemoretoriumdays QTR2
Case 3
moretoriumdays = 32 - Days
chequemoretoriumdays QTR2
Case 4
...
Case 12
moretoriumdays = 32 - Days
chequemoretoriumdays QTR1
End Select
End Sub
Private Sub chequemoretoriumdays(qtr As Integer)
If moretoriumdays <= 70 Then
moretoriumdays = moretoriumdays + qtr
addqtr = True
End If
End Sub
Private Sub calculatemoretorium()
moretorium = newamount * (roi / 100) * (moretoriumdays / 365)
End Sub
Private Sub calculateinterest()
Dim pamt As Long
pamt = newamount / noq
interest = newamount * (roi / 100) * (21 / 40) * (1 / 4)
'break point is here it shows 2 diff values of instude variable
instdue = Round(pamt + interest)
End Sub
Private Sub calculatebalance()
If cheque1 = False Then
balance = instdue * noq + moretorium
ElseIf cheque2 = False Then
Dim previnstdue As Long
previnstdue = rs_clients!clientamounttdue
balance = instdue * noq + moretorium + prevmoretorium + (qtrdiff * previnstdue)
Debug.Print instdue, balance
End If
End Sub
Private Sub updateclient()
rs_clients.FindFirst "clientid=" & clientcode
If rs_clients.NoMatch = False Then
rs_clients.Edit
If cheque1 = False Then
rs_clients!clientstartdate = DTPicker1.Value
End If
rs_clients!clientmoretorium = moretorium + prevmoretorium
rs_clients!clientamounttdue = instdue
rs_clients!clientorgbalance = balance
rs_clients!clientbalance = balance - amtpaid
rs_clients!clientinterest = interest
rs_clients.Update
End If
End Sub
Private Sub updatecheques()
If cheque1 = False Then
rs_cheques.addnew
rs_cheques!clientcode = clientcode
rs_cheques!chequeno1 = Text1.Text
rs_cheques!chequedate1 = DTPicker1.Value
rs_cheques!chequeamt1 = CLng(Text4.Text)
rs_cheques!chequemoretorium1 = moretorium
rs_cheques!moretoriumdays1 = moretoriumdays
rs_cheques!appendqtr = addqtr
rs_cheques.Update
ElseIf cheque2 = False Then
rs_cheques.FindFirst "clientcode=" & clientcode
If rs_cheques.NoMatch = False Then
rs_cheques.Edit
rs_cheques!chequeno2 = Text2.Text
rs_cheques!chequedate2 = DTPicker2.Value
rs_cheques!chequeamt2 = CLng(Text5.Text)
rs_cheques!chequemoretorium2 = moretorium
rs_cheques!moretoriumdays2 = moretoriumdays
rs_cheques.Update
End If
End If
End Sub
'''' procedures used in case of second chque '''''
Private Sub quarterdifference()
qtrdiff = DateDiff("q", DTPicker1, DTPicker2)
If qtrdiff > 0 And appqtr = True Then
qtrdiff = qtrdiff - 2
ElseIf qtrdiff > 0 Then
qtrdiff = qtrdiff - 1
End If
noq = noq - qtrdiff
End Sub
Private Sub findamountpaid()
Dim intrestpaid As Long, idue As Long
Dim sd As Integer
amtpaid = 0: intrestpaid = 0
Set rs_ledger = db2.OpenRecordset("SELECT pdate,installmentpaid " _
& "from clientledger WHERE clientcode=" & clientcode & " ORDER BY pdate")
If rs_ledger.RecordCount <> 0 Then
While Not rs_ledger.EOF
amtpaid = amtpaid + rs_ledger!installmentpaid
rs_ledger.MoveNext
Wend
End If
idue = rs_clients!clientamounttdue
idue = idue * qtrdiff
intrestpaid = rs_clients!clientinterest * qtrdiff
idue = idue - intrestpaid
cmargin = Round((amtsanctioned * (schmargin / 100)))
newamount = CLng(Text4) + CLng(Text5) - cmargin - idue
sd = 9
End Sub
Private Sub clearvalues()
moretorium = 0
moretoriumdays = 0
.
.
End Sub
Private Sub recalculate()
Dim q As Integer
If DTPicker2.Value < DTPicker1.Value Then
MsgBox "Date-2 cannot be before Date-1"
Else
q = DateDiff("q", DTPicker1, DTPicker2)
If (q = 1 And appqtr = True) Then 'recalculate only if second cheque is issued with in the moretorium period
moretoriumdays = (DTPicker2.Value - DTPicker1.Value)
deductmargin
calculatemoretorium
chk1moretorium = moretorium
chk1moretoriumdays = moretoriumdays
moretoriumchanged = True
showchk1values
moretoriumdays = prevmoretoriumdays - moretoriumdays
ElseIf (q = 0 And appqtr = False) Then
moretoriumdays = (DTPicker2.Value - DTPicker1.Value)
deductmargin
calculatemoretorium
chk1moretorium = moretorium
chk1moretoriumdays = moretoriumdays
moretoriumchanged = True
showchk1values
If moretoriumdays <= 70 Then
moretoriumdays = prevmoretoriumdays - moretoriumdays
Else
moretoriumdays = 91 - moretoriumdays
End If
ElseIf (q = 0 And appqtr = True) Then
moretoriumdays = (DTPicker2.Value - DTPicker1.Value)
deductmargin
calculatemoretorium
chk1moretorium = moretorium
chk1moretoriumdays = moretoriumdays
moretoriumchanged = True
showchk1values
moretoriumdays = prevmoretoriumdays - moretoriumdays
Else
Frame3.Visible = False
End If
End If
End Sub
Private Sub reupdatecheque()
If moretoriumchanged = True Then
rs_cheques.Edit
rs_cheques!chequemoretorium1 = chk1moretorium
rs_cheques!moretoriumdays1 = chk1moretoriumdays
rs_cheques.Update
End If
End Sub
Private Sub showvalues()
Label4.Caption = moretoriumdays
Label6.Caption = moretorium
Label8.Caption = interest
Label10.Caption = instdue
Label12.Caption = balance
End Sub
Private Sub showchk1values()
Label14.Caption = chk1moretoriumdays
Label15.Caption = chk1moretorium
Frame3.Visible = True
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|