Perhaps I am missing something, but I think you just use the following:
Code:
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("tblYourTableName", dbOpenDynaset)
With rs
.FindFirst "Your Criteria"
.Edit
!FieldName = "UpdatedInfo"
.Update
End With
I don't want to change the name of the field, I want to search a specific field (eg Field1) for my condition and then change the actual entry in a different field of the same record (eg Field2). How can I do this?
My best advice for you is to use the Search on this forum....
Its amazing what you will find, and what you are asking has been answered many times, so I am sure you will find what you want.
While I agree with Braindead (that doesn't sound right!
), the code I gave you above does exactly what you want to do. It does not change the name of the field. It changes the entry in that field for the record that was found with your criteria.
I'm sure you'll be pleased to know that this foray into the world of Access and VBA is only temporary and I would imagine that this is the last stupid question (from me at least) you'll have to answer.
Don't give up, there are a great many here who don't regard newbies to Access or vba as stupid. Access and vba can become fascinating and addictive once you overcome initial frustration, and even the "experts" suffer the same frustrations from time to time.
I hope you didn't take my response to imply that I didn't think your question was appropriate. Please, post away!
I guess I am just noticing more and more that the same questions appear often in these forums (or are easily answered in Access Help files), showing that the poster didn't put any effort in to finding the answer themselves first.
I'm sorry if I came off wrong.
[This message has been edited by shacket (edited 09-06-2001).]
You can also build a Select Query that filters the records to only return those based on the criteria you set. After you a sure the query returns the need records, simply change this Select Query to an Update Query. If this is only needed for a "one time deal", delete this query once you have completed the task at hand.
This site is a great resource and sometimes it is just a bit too tempting to ask a question without having fully researched its answer first. I'm only dabbling in this stuff for a quick project so don't be alarmed when I disappear never to be seen again...it's certainly not the attitude of the posters that will have caused this.