Hello Again:
I am almost done with my user form. The last piece I'm struggling with is the Save Changes code. I am able to find/search for a record and I want the user to be able to update the record and save the changes (on the line the record is found, not add a new record). However, when I tried to modify a record and "Save" the changes, nothing happens.
Here is the code I'm using:
I have cross posted this here: http://www.excelforum.com/excel-pro...rds-listbox-populating-issue.html#post4119342
I am almost done with my user form. The last piece I'm struggling with is the Save Changes code. I am able to find/search for a record and I want the user to be able to update the record and save the changes (on the line the record is found, not add a new record). However, when I tried to modify a record and "Save" the changes, nothing happens.
Here is the code I'm using:
Code:
Private Sub cmdSave_Click() Application.ScreenUpdating = False
If r <= 0 Then Exit Sub
Set c = Ws.Cells(r, 1)
c.Value = Me.tbMemNum.Value ' write amendments to database
c.Offset(0, 1).Value = Me.tbDate1.Value
c.Offset(0, 2).Value = Me.cboIssueType.Value
c.Offset(0, 3).Value = Me.cboIssueReportedBy.Value
c.Offset(0, 4).Value = Me.tbDateIssue.Value
c.Offset(0, 5).Value = Me.cboIssueStatus.Value
c.Offset(0, 6).Value = Me.tbSource.Value
c.Offset(0, 7).Value = Me.tbOpenDate.Value
c.Offset(0, 8).Value = Me.tbEnrollMeth.Value
c.Offset(0, 9).Value = Me.cboUI.Value
c.Offset(0, 10).Value = Me.tbFName.Value
c.Offset(0, 11).Value = Me.tbLName.Value
c.Offset(0, 12).Value = Me.tbAddress.Value
c.Offset(0, 13).Value = Me.tbCity.Value
c.Offset(0, 14).Value = Me.tbState.Value
c.Offset(0, 15).Value = Me.tbZip.Value
c.Offset(0, 16).Value = Me.tbFraud.Value
c.Offset(0, 17).Value = Me.tbBonusPt.Value
c.Offset(0, 18).Value = Me.tbGoldPt.Value
c.Offset(0, 19).Value = Me.tbOtherPt.Value
c.Offset(0, 20).Value = Me.tbPtsRedeemed.Value
c.Offset(0, 21).Value = Me.tbPoint.Value
c.Offset(0, 22).Value = Me.tbDollar.Value
c.Offset(0, 23).Value = Me.cboSiteID.Value
c.Offset(0, 24).Value = Me.Brand.Caption
c.Offset(0, 25).Value = Me.SiteAdd.Caption
c.Offset(0, 26).Value = Me.GM.Caption
c.Offset(0, 27).Value = Me.Owner.Caption
c.Offset(0, 28).Value = Me.tbSummary.Value
c.Offset(0, 29).Value = Me.cboCredit.Value
c.Offset(0, 30).Value = Me.tbCrAmt.Value
c.Offset(0, 31).Value = Me.tbCrDate.Value
'restore Form
With Me
.cmdSave.Enabled = True
.cmdAdd.Enabled = False
.Height = frmHt
End With
If Sheet1.AutoFilterMode Then Sheet1.Range("A1").AutoFilter
Application.ScreenUpdating = True
On Error GoTo 0
End Sub
I have cross posted this here: http://www.excelforum.com/excel-pro...rds-listbox-populating-issue.html#post4119342
Last edited: