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

Microsoft Access Run-Time Error '424' Object Required

P: 1
In my database, I have a search form in which I am trying to allow users to double click on an entry in the search form which will open another form to allow for edits. I am getting a Run-time '424' object required error. When debugging the code, it stops on the second line below.

I would greatly appreciate any help.

Thanks, Ryan.

Expand|Select|Wrap|Line Numbers
  1. Private Sub LstSearchResults_DblClick(Cancel As Integer)
  2.  
  3.  
  4.    Form_frmtry.SetFocus
  5.  
  6.      'Find the record that matches the control.
  7.    Dim rs As Object
  8.  
  9.     Set rs = Form_frmtry.Recordset.Clone
  10.     rs.FindFirst "tblHardwareMaster.[DBID] = " & Form_HardwareSearch.LstSearchResults.Column(0)
  11.     If Not rs.EOF Then Form_frmtry.Bookmark = rs.Bookmark
  12.  
  13. End Sub
  14.  
Aug 7 '07 #1
Share this Question
Share on Google+
2 Replies


JKing
Expert 100+
P: 1,206
I believe this error is being raised because an instance of your entry form has not been created. Instead of trying to set focus to the form, you can use the open form command.

Try adding this in:
Expand|Select|Wrap|Line Numbers
  1. Private Sub LstSearchResults_DblClick(Cancel As Integer)
  2.  
  3.  Docmd.OpenForm "frmTry"
  4.  
  5.  'Find the record that matches the control.
  6.  Dim rs As DAO.Object
  7.  
  8.  Set rs = [Forms]![frmTry].Recordset.Clone
  9.  rs.FindFirst "tblHardwareMaster.[DBID] = " & Form_HardwareSearch.LstSearchResults.Column(0)
  10. If Not rs.EOF Then 
  11. [Forms]![frmTry].Bookmark = rs.Bookmark
  12. End If
  13. End Sub
  14.  
I've also changed your references to the form to one that use the Forms collection.
Aug 7 '07 #2

JKing
Expert 100+
P: 1,206
For future reference, you should know that we here at TSDN prefer your code to be posted in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use [code] tags in future.

MODERATOR.

Welcome to thescripts!
Aug 7 '07 #3

Post your reply

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