vba courses london - finding and updating records

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

Forum home » Delegate support and help forum » Microsoft VBA Training and help » vba courses london - Finding and updating records in a form

vba courses london - Finding and updating records in a form

resolvedResolved · Low Priority · Version Standard

Louise has attended:
Access VBA course

Finding and updating records in a form

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

RE: Finding and updating records in a form

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

RE: Finding and updating records in a form

Hi David,

Thank you for your reply I will give it a go!!

Louise


 

VBA tip:

Empty The Clipboard with CutCopyMode

After 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:

ActiveSheet.Paste
Application.CutCopyMode = False

View all VBA hints and tips


Server loaded in 0.05 secs.