Formerly Best Training
© 2024 STL. All Rights Reserved.
All prices offered for business users and exclude VAT. E&OE
2nd Floor, CA House, 1 Northey Street, Limehouse Basin, London, E14 8BT. United Kingdom
Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Finding and updating records in a form
Resolved · Low Priority · Version Standard
Louise has attended:
Access VBA course
I want to be able to search a field in a form and if a question has not been answered correctly (currently reads "tbc") then go to that record so that the user can amend it.
I have tried using recordsets and it will successfully locate the record but when I change the record to say "No" and then press my button and the error appears again so the user needs to change it again I get error 3020.
I can see why I'm getting this error because I am not writing my inital change to the table but I'm not sure where to put the .update.
This is the code:
Me.RecordsetClone.MoveFirst
Me.Bookmark = Me.RecordsetClone.Bookmark
Me.RecordsetClone.FindFirst "ActionTakenNY = 'tbc'"
If Me.RecordsetClone.NoMatch = True Then
MsgBox "Everything ok"
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
Me.RecordsetClone.Close
End Sub
Hi Louise
Sorry for the delay in getting back to you, but we have been very busy.
If I was trying to solve this problem waht I would do is
- use what you have done so far, so that you go to the record that with tbc.
-I would include a button on the form that says update, so when you have change tbc to no, you would click the update button, this is where you would write the change to the database using the .update. You could take this a step further and have a message box that says "are you sure that you want to update this record.
Hope this helps and again sorry for the delay.
David
|
VBA tip:Empty The Clipboard with CutCopyModeAfter each Copy/Paste operation in VBA, you should use the following line of code to empty the clipboard. This ensures that the computer memory doesn't overload: |
We'll call during UK business hours
Server loaded in 0.07 secs.