Private Sub submit_Click()
Dim PaymentDate As Date
Dim PartnerId As Integer
Dim Amount As Double
Dim paid As Double
Dim inst As Double
Dim start As Double
Dim diff As Date
Dim check As Double
paid = Me.paininstall.Value
inst = Me.Installments.Value
start = Me.StartAmount.Value
PaymentDate = Me.pDate.Value
PartnerId = Me.cboPartnerId.Value
Amount = Me.payamt.Value
check = (inst - paid) * start
If Amount > check Then
MsgBox ("This amount will cause an OVERPAYMENT")
Me.payamt.Value = check
MsgBox ("The ACCEPTABLE amount has been set for you")
Else
MsgBox ("This amount is ACCEPTABLE")
End If
'DoCmd.RunSQL "INSERT INTO PAYMENTS (PartnerId,Amount,PaymentDate) VALUES (" & PartnerId & ", " & Amount & ", #" & PaymentDate & "# );"
'Me.PartnerId = Eval(Replace(Me.PartnerId.DefaultValue, "=", ""))
Me.cboTerm.Value = Null
Me.cboTrn.Value = Null
Me.ActualBalance.Value = Null
Me.StartAmount.Value = Null
Me.StartDate.Value = Null
Me.MaturityDate.Value = Null
Me.MaturityAmount.Value = Null
Me.Installments.Value = Null
Me.EndDate.Value = Null
Me.cboCusId.Value = Null
Me.cboPartnerId.Value = Null
Me.strtbtn.Enabled = True
Me.srvbtn.Enabled = False
Me.payment.Visible = False
Me.pDate.Visible = False
Me.payamt.Visible = False
Me.Label38.Visible = False
Me.submit.Enabled = False
Me.cboCusId.Enabled = False
Me.cboPartnerId.Enabled = False
Me.PartnerId.Visible = True
Me.Label17.Visible = True
Me.Label41.Visible = False
Me.Label43.Visible = False
Me.lastpay.Visible = False
Me.paininstall.Visible = False
End Sub
thats my code. here is what i want to do:
1. if the amount to be paid is more than what is required i wanna sop them and tell them the amount they r trying to pay will cause an over payment. i want to always check the amount, give an alert and set correct amount
2. i then calculated how much they need to pay and set it in the payment field.
3. i then want them to click sumbit and then i update my database.
4. after which i want to disable some fields, jide some others and set some values to null.
how can i achieve this.
Dim PaymentDate As Date
Dim PartnerId As Integer
Dim Amount As Double
Dim paid As Double
Dim inst As Double
Dim start As Double
Dim diff As Date
Dim check As Double
paid = Me.paininstall.Value
inst = Me.Installments.Value
start = Me.StartAmount.Value
PaymentDate = Me.pDate.Value
PartnerId = Me.cboPartnerId.Value
Amount = Me.payamt.Value
check = (inst - paid) * start
If Amount > check Then
MsgBox ("This amount will cause an OVERPAYMENT")
Me.payamt.Value = check
MsgBox ("The ACCEPTABLE amount has been set for you")
Else
MsgBox ("This amount is ACCEPTABLE")
End If
'DoCmd.RunSQL "INSERT INTO PAYMENTS (PartnerId,Amount,PaymentDate) VALUES (" & PartnerId & ", " & Amount & ", #" & PaymentDate & "# );"
'Me.PartnerId = Eval(Replace(Me.PartnerId.DefaultValue, "=", ""))
Me.cboTerm.Value = Null
Me.cboTrn.Value = Null
Me.ActualBalance.Value = Null
Me.StartAmount.Value = Null
Me.StartDate.Value = Null
Me.MaturityDate.Value = Null
Me.MaturityAmount.Value = Null
Me.Installments.Value = Null
Me.EndDate.Value = Null
Me.cboCusId.Value = Null
Me.cboPartnerId.Value = Null
Me.strtbtn.Enabled = True
Me.srvbtn.Enabled = False
Me.payment.Visible = False
Me.pDate.Visible = False
Me.payamt.Visible = False
Me.Label38.Visible = False
Me.submit.Enabled = False
Me.cboCusId.Enabled = False
Me.cboPartnerId.Enabled = False
Me.PartnerId.Visible = True
Me.Label17.Visible = True
Me.Label41.Visible = False
Me.Label43.Visible = False
Me.lastpay.Visible = False
Me.paininstall.Visible = False
End Sub
thats my code. here is what i want to do:
1. if the amount to be paid is more than what is required i wanna sop them and tell them the amount they r trying to pay will cause an over payment. i want to always check the amount, give an alert and set correct amount
2. i then calculated how much they need to pay and set it in the payment field.
3. i then want them to click sumbit and then i update my database.
4. after which i want to disable some fields, jide some others and set some values to null.
how can i achieve this.