Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add New Record

Status
Not open for further replies.

xcelpro

Technical User
May 28, 2005
11
US
Hi all-
Using VS2003

Have code set to add new record to my sql table
Record position does advance
All text boxes ReadOnly property set to False
However all text boxes showing values from previous record rather than clearing for new entries

Any ideas what I'm doing wrong?
I use very similar code in another project and it works exactly as expected

Thanks
-xl
Code:
Private Sub btnAddRec_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnAddRec.Click
    'Begin an add operation

    UnLockCustomerTextBoxes()
    UnLockBalanceInformation()
    UnLockPaymentInformation()
    UnLockInterestCharges()

    DisableNavigation()
    SetButtonsForEdit()
    bmCreditCard.AddNew()
    txtCustomerNumber.Focus()
End Sub

 
Thanks Ruffnekk
Here's the full monty
Code:
Private Sub btnAddRec_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnAddRec.Click
    'Begin an add operation

    UnLockCustomerTextBoxes()
    UnLockBalanceInformation()
    UnLockPaymentInformation()
    UnLockInterestCharges()

    DisableNavigation()
    SetButtonsForEdit()
    bmCreditCard.AddNew()
    txtCustomerNumber.Focus()
End Sub

Private Sub UnLockCustomerTextBoxes()
    'Unlock for add or delete

    txtCustomerNumber.ReadOnly = False
    txtLastName.ReadOnly = False
    txtFirstName.ReadOnly = False
    txtMI.ReadOnly = False
End Sub

Private Sub UnLockBalanceInformation()
    'Unlock for add or delete

    txtPreviousBalance.ReadOnly = False
    txtPreviousPayment.ReadOnly = False
    txtCurrentBalance.ReadOnly = False
    txtCurrentPaymentDueDate.ReadOnly = False
End Sub

Private Sub UnLockPaymentInformation()
    'Unlock for add or delete

    txtCurrentPayment.ReadOnly = False
    dtmPaymentDate.Visible = True
    txtNewBalanceAfterInterestCharges.ReadOnly = False
    txtNewBalanceAfterPayment.ReadOnly = False
End Sub

Private Sub UnLockInterestCharges()
    'Unlock for add or delete

    txtInterestChargesYTD.ReadOnly = False
    txtInterestChargeUnpaidBalance.ReadOnly = False
    txtInterestChargeLatePayment.ReadOnly = False
    txtInterestChargeYTDNew.ReadOnly = False
End Sub

Private Sub DisableNavigation()
    'Disable navigation

    btnFirstRec.Enabled = False
    btnNextRec.Enabled = False
    btnPreviousRec.Enabled = False
    btnLastRec.Enabled = False
End Sub

Private Sub SetButtonsForEdit()
    'Setup the buttons for an Add or Edit operation

    btnSaveRec.Enabled = True
    btnDeleteRec.Enabled = False
    btnEditRec.Enabled = False
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top