Findrecord giving a msg

G

Guest

I want to clear a rcord from a form. I open the table and then do the code
below(snippet):
DoCmd.FindRecord forms!frmname.[ID}
Me.AllowEdits = True 'Edit Record
Me!ID.Enabled = 0
rstRC_Main.Edit
nam = rstRC_Main![Last Name]
rstRC_Main![Last Name] = Null

the findrecord gives me a msg saying it is not available now.
Can someone explain.

Mike
 
S

strive4peace

your FindRecord statement ends in a curly brace rather than
a bracket ... didn't know if it was a typo or an error...

another way to locate the record if you are working with a
form (as you should when you are modifying data in tables)
is this:

Me.RecordsetClone.FindFirst "IDfield = " & forms!frmname.ID

If Not Me.RecordsetClone.NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
else
'record not found
Exit sub
End If

before you switch records, do either

'undo changes to record
if me.dirty then me.undo
OR
'save record
if me.dirty then me.dirty = false

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
 

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

Similar Threads

FindRecord Error 2
FindRecord problem 1
FindRecord Code problem 1
Form with two nested subforms. 8
Locked field 4
Somebody Please Help Me 24
Wierd error message on form. 7
Finding a Record in a Subform 3

Top