Hello and helpppppppppppppp!!!!!!
I am having a problem when I try to change a data field on a form and have tried most of the fixes contained in the write conflict keyword search, but none seems to work.
I open a form to see the rows in a table using the query as the record source:
SELECT * FROM ACCCODES;
There are two fields in the table: NUMBER and DESCRIPT
Then I click a button on the form to modify records which opens another form with a combo box showing all available records. I select a record either by clicking on it or with the up/down arrow keys and the enter key. As I open the modify form, I close the combo box form and the original form and set focus to the DESCRIPT field on the modify form. I change the DESCRIPT field, click the save record button and
Here is my code:
Private Sub Form_AfterUpdate()
Dim db As Database
Dim rec As DAO.Recordset
Dim strOldDescript As String
Set db = CurrentDb()
Set rec = db.OpenRecordset("SELECT * FROM ACCCODES WHERE [NUMBER] = '" & _
Me![ACCCODES.NUMBER] & "'", dbOpenDynaset)
strOldDescript = rec![DESCRIPT]
With rec
.Edit
![DESCRIPT] = strDescript.Value
.Update
Debug.Print ![NUMBER]
Debug.Print ![DESCRIPT]
.Bookmark = .LastModified
.Close
End With
PREVIOUS ATTEMPTS AT CORRECTING THIS PROBLEM:
'DoCmd.RunCommand acCmdSaveRecord
'DoCmd.Close 'Editing form
'Forms!MainForm.Requery
'Me.Recalc
'Me.Refresh
strSave = "YES"
Set rec = Nothing
db.Close
Set db = Nothing
'Forms![ACCOUNT_CODES_MODIFY].Visible = False
This is where I have the problem of WRITE CONFLICT with the three choices:
DoCmd.CloseForm acForm, "ACCOUNT_CODES_MODIFY"
DoCmd.OpenForm "ACCOUNT CODES"
End Sub
Please can anyone suggest something else to try!
Thanks
Francis
I am having a problem when I try to change a data field on a form and have tried most of the fixes contained in the write conflict keyword search, but none seems to work.
I open a form to see the rows in a table using the query as the record source:
SELECT * FROM ACCCODES;
There are two fields in the table: NUMBER and DESCRIPT
Then I click a button on the form to modify records which opens another form with a combo box showing all available records. I select a record either by clicking on it or with the up/down arrow keys and the enter key. As I open the modify form, I close the combo box form and the original form and set focus to the DESCRIPT field on the modify form. I change the DESCRIPT field, click the save record button and
Here is my code:
Private Sub Form_AfterUpdate()
Dim db As Database
Dim rec As DAO.Recordset
Dim strOldDescript As String
Set db = CurrentDb()
Set rec = db.OpenRecordset("SELECT * FROM ACCCODES WHERE [NUMBER] = '" & _
Me![ACCCODES.NUMBER] & "'", dbOpenDynaset)
strOldDescript = rec![DESCRIPT]
With rec
.Edit
![DESCRIPT] = strDescript.Value
.Update
Debug.Print ![NUMBER]
Debug.Print ![DESCRIPT]
.Bookmark = .LastModified
.Close
End With
PREVIOUS ATTEMPTS AT CORRECTING THIS PROBLEM:
'DoCmd.RunCommand acCmdSaveRecord
'DoCmd.Close 'Editing form
'Forms!MainForm.Requery
'Me.Recalc
'Me.Refresh
strSave = "YES"
Set rec = Nothing
db.Close
Set db = Nothing
'Forms![ACCOUNT_CODES_MODIFY].Visible = False
This is where I have the problem of WRITE CONFLICT with the three choices:
DoCmd.CloseForm acForm, "ACCOUNT_CODES_MODIFY"
DoCmd.OpenForm "ACCOUNT CODES"
End Sub
Please can anyone suggest something else to try!
Thanks
Francis