FindRecord Not Changing the CurrentRecord?

H

HumanJHawkins

Hi,

I am attempting to control and error check the deletion of records that
my users are allowed to do. So I want to have an edit box and a delete
button on my form. The user will put a record ID into the edit box and
then click delete.

I have been attampting to use something like the following:

Me.DeleteThis.SetFocus
DoCmd.FindRecord Me.DeleteThis
DoCmd.RunCommand acCmdDeleteRecord

But I also want to check to make sure that the FindRecord worked and
that we are on the field that needs to be deleted...

If I add a check that the variables match, like this:

Me.FieldInRecordToDelete.SetFocus
DoCmd.FindRecord Me.DeleteCriteria

If (Me.FieldInRecordToDelete = Me.DeleteCriteria) then
DoCmd.RunCommand acCmdDeleteRecord
End If

The delete never happens, because Me.FieldInRecordToDelete has some
other value... I am guessing because the CurrentRecord was not updated
by the FindRecord method?

Can anyone tell me what I am doing wrong?
Many thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top