bobleonard
Programmer
This code, though it moves to the record I input, it always edits record number 1. The ID field is an auto-number field. I put this code together from examples but I don't know what I'm doing wrong.
Thanks for any input. I took out the 'useful' code because it doesn't matter for 'Edit' problem. I move to correct record but alway Edit record #1
Private Sub Command232_Click()
Dim dbsThisOne As DAO.Database
Dim rs As DAO.Recordset
Dim recnum, recsave As Long
On Local Error GoTo FormFindREcord_Err
Set dbsThisOne = CurrentDb
Set rs = dbsThisOne.OpenRecordset("People", dbOpenDynaset)
recnum = InputBox("enter the record Number to Import")
recsave = recnum
Me!ID.SetFocus
Me!ID.Enabled = True
DoCmd.GoToControl "ID"
DoCmd.FindRecord recnum, , True, , True
Refresh
MsgBox ("Did a move to that Record?") 'debug
rs.Edit
'Add data
rs!Dpoint1 = recnum
'Commit the changes
rs.Update
skipupdate:
rs.Close
Set rs = Nothing
dbsThisOne.Close
Set dbsThisOne = Nothing
GoTo exithere
FormFindREcord_Err:
MsgBox Err.Description
Resume exithere
exithere:
End Sub
Thanks for any input. I took out the 'useful' code because it doesn't matter for 'Edit' problem. I move to correct record but alway Edit record #1
Private Sub Command232_Click()
Dim dbsThisOne As DAO.Database
Dim rs As DAO.Recordset
Dim recnum, recsave As Long
On Local Error GoTo FormFindREcord_Err
Set dbsThisOne = CurrentDb
Set rs = dbsThisOne.OpenRecordset("People", dbOpenDynaset)
recnum = InputBox("enter the record Number to Import")
recsave = recnum
Me!ID.SetFocus
Me!ID.Enabled = True
DoCmd.GoToControl "ID"
DoCmd.FindRecord recnum, , True, , True
Refresh
MsgBox ("Did a move to that Record?") 'debug
rs.Edit
'Add data
rs!Dpoint1 = recnum
'Commit the changes
rs.Update
skipupdate:
rs.Close
Set rs = Nothing
dbsThisOne.Close
Set dbsThisOne = Nothing
GoTo exithere
FormFindREcord_Err:
MsgBox Err.Description
Resume exithere
exithere:
End Sub