Results 1 to 8 of 8
  1. #1
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239

    Unhappy help - Forms SEARCH box

    Hi, my VB skills are at beginner level and I need assistance with this code please. It is code for a SEARCH box on my form. This textbox uses a subform to filter based on the user's input.



    I have this code below but I am getting Error 424 "object required" - the 6th line of code is highlighted in yellow. I really appreciate any assistance with this.

    Private Sub cmdSRCHBOX_Change()
    If Len(cmdSRCHBOX.Text & vbNullString) = 0 Then
    SearchForm.Form.Filter = vbNullString
    SearchForm.Form.FilterOn = False
    Else
    SearchForm.Form.Filter = "[TripID] Like '*" & cmdSRCHBOX.Text & "*' OR [PatientID] Like '*" & cmdSRCHBOX.Text & "*'"
    SearchForm.Form.FilterOn = True
    End If
    End Sub

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    The error is because it is looking for a subform container named, "SearchForm".

    If you type Me and then dot (.), does SearchForm appear?

  3. #3
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    Hi, thanks for your response. apologies, I didn't provide all the details. My main form is PaediatricForm and my subform is called Searchform. Are you saying that in the code, I should replace ALL the Searchform with "Me."?

    I tried this anyway and it is still giving error 424

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    As a test, if you type (somewhere in your form's module) Me and then dot (.), does SearchForm appear? This may help you to determine why the error is occurring. Use intellisense.

  5. #5
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    If I type "Me."on a blank line, yes intellisense comes up but it has a list of suggestions listed in alphabetical order beginning with ActiveObject which I don't think I need...

  6. #6
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    sorry Searchform does not come up

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    That is why you are getting the error.

    SearchForm.Form.Filter indicates that you have a subform control named SearchForm. The .Form after the name is looking to the child object which is a form. The .Filter is a property of this form object. You need to make sure all of these are available. Start by getting the name of your subform control/container. While in design view of your form, highlight the subform control and look at the property sheet. Click the Other tab and see what the name is.

    Once you know the name, you can use intellisence by typing Me dot and the name then dot...

  8. #8
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    thank you!!! the error WAS the form name. don't mind me but I LOVE you right now!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with Search Forms/SubForms
    By KCC47 in forum Forms
    Replies: 1
    Last Post: 04-05-2013, 12:54 PM
  2. Search forms
    By chris17 in forum Forms
    Replies: 12
    Last Post: 02-05-2013, 06:05 PM
  3. Search Forms
    By K1NJO in forum Forms
    Replies: 3
    Last Post: 11-29-2011, 03:58 PM
  4. Search forms and sub forms
    By FadingAPE in forum Forms
    Replies: 1
    Last Post: 12-15-2010, 01:59 PM
  5. Search function in forms
    By vCallNSPF in forum Forms
    Replies: 1
    Last Post: 03-14-2010, 06:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums