By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,544 Members | 840 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,544 IT Pros & Developers. It's quick & easy.

Delete Record Button and Getting a "compile error"

100+
P: 121
This is a very simple question....

I have a form that looks up Records for an unbound drop-down list.
It has worked just fine up until last night.

Now the button on the form to delete a record doesn't work. i get a
"compile error: method or data member not found".

The code for the drop-down is this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub REC_ID_COMBO_AfterUpdate()
  2.     Dim rs As DAO.Recordset
  3.  
  4.     If Not IsNull(Me!REC_ID_Combo) Then
  5.         'Save before move.
  6.         If Me.Dirty Then
  7.             Me.Dirty = False
  8.         End If
  9.         'Search in the clone set.
  10.         Set rs = Me.RecordsetClone
  11.         rs.FindFirst "[REC_ID] = """ & Me!REC_ID_Combo & """"
  12.         If rs.NoMatch Then
  13.             MsgBox "Not found: filtered?"
  14.         Else
  15.             'Display the found record in the form.
  16.             Me.Bookmark = rs.Bookmark
  17.         End If
  18.         Set rs = Nothing
  19.     End If
  20. End Sub


The code to delete a record is:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command389_Click()
  2. On Error GoTo Err_Command389_Click
  3.  
  4.  
  5.     DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
  6.     DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
  7.  
  8. Exit_Command389_Click:
  9.     Exit Sub
  10.  
  11. Err_Command389_Click:
  12.     MsgBox ERR.Description
  13.     Resume Exit_Command389_Click
  14.  
  15. End Sub
One more bit of information... when I point the record source to another table (that is mostly identical) the button works fine. But when I point it back to my ERR_REC table, I get the error again.


Can anyone please help. I have been working on this for 6 hours and have found no answers.
Apr 20 '07 #1
Share this Question
Share on Google+
6 Replies

Rabbit
Expert Mod 10K+
P: 12,441
Does it tell you which line is causing the problem?
Apr 20 '07 #2

100+
P: 121
First, I apologize about the double post. I didn't realize I had double posted. My browser hung in submitting the post, so I resent it. It must have got through the first time.


Second, when I run the command, the yellow error points to the first line the: Private Sub Command389_Click()

The cursors highlights the msgbox error.description.


Thanks for the help
Apr 20 '07 #3

Rabbit
Expert Mod 10K+
P: 12,441
Well, the error means that it can't find the description property of the object err. I know it exists so perhaps you're missing a reference, did you check those?
Apr 20 '07 #4

100+
P: 121
Well, the error means that it can't find the description property of the object err. I know it exists so perhaps you're missing a reference, did you check those?

You're right I found the missing reference. I knew it was something simple, but after staring at it so long I was running out of ideas.

Thanks for your help. You're a life saver
Apr 20 '07 #5

Rabbit
Expert Mod 10K+
P: 12,441
You're right I found the missing reference. I knew it was something simple, but after staring at it so long I was running out of ideas.

Thanks for your help. You're a life saver
Not a problem, good luck.
Apr 20 '07 #6

Denburt
Expert 100+
P: 1,356
If I might may I make a suggestion that could save you a headache in the future?

Instead of using:

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Try using:

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDelete

So much more reliable, Domenuitem relies on Microsoft never changing menus....
Sketchy at best.
Apr 20 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.