Hi all,
Not sure how to do this but what i want to do is update a record, which would add a value to a field from a textbox to an existing record.
I have a command button on the form which when pressed should carry this out. The table i want to update to is called: Address. The field i want to update to is called Code. I want the code to check if field: A2 of table Address is equal to textbox A2 and field A4 is equal to textbox A4, if so then update field: Code, of that record being viewed with the value in textbox Code.
I have code that will add a new record but not update to a field in an existing record, this is my code:
Any help appreciated, thank in advance,
M-.
Not sure how to do this but what i want to do is update a record, which would add a value to a field from a textbox to an existing record.
I have a command button on the form which when pressed should carry this out. The table i want to update to is called: Address. The field i want to update to is called Code. I want the code to check if field: A2 of table Address is equal to textbox A2 and field A4 is equal to textbox A4, if so then update field: Code, of that record being viewed with the value in textbox Code.
I have code that will add a new record but not update to a field in an existing record, this is my code:
Code:
Dim Db As Database
Dim rec As Recordset
Set rec = CurrentDb.OpenRecordset("Address")
rec.AddNew
rec("Code") = Me.Code
rec.Update
Set Db = Nothing
Any help appreciated, thank in advance,
M-.