Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: FindRecord Not Changing the CurrentRecord?

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

FindRecord Not Changing the CurrentRecord?
"HumanJHawkins" <JHawkins[ at ]Locutius.Com> 15.09.2006 21:26:49
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!

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net