Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214
    I'm sorry, but I don't know if it's just been long day, but where do I put the SQL code in my current code?

    Dim mySQL as string


    mySQL="Select * FROM Search " & Buildfilter

    debug.print mySQL

    me.searchsubform.form.recordsource=mySQL

  2. #17
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You currently have this (based on your earlier post)

    Private Sub Search_Click()
    'Update the record source
    Me.SearchSubform.Form.RecordSource = "SELECT * FROM Search " & BuildFilter
    'Requery the subform
    Me.SearchSubform.Requery
    End Sub


    You need to replace it with the code I provided; like this:

    Private Sub Search_Click()
    'Update the record source
    Dim mySQL as string
    mySQL="Select * FROM Search " & Buildfilter
    debug.print mySQL
    me.searchsubform.form.recordsource=mySQL
    'Requery the subform

    Forms!SearchSubform.form.requery
    End Sub

    Basically, I'm getting rid of the stuff shown in red above.

  3. #18
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214
    This is what showed up in the immediate window after I updated the code like you suggested.

    Code:
    Select * FROM Search WHERE[FirstName] LIKE '*Brad*'
    Select * FROM Search WHERE[FirstName] LIKE '**'
    Select * FROM Search WHERE[FirstName] LIKE '**'
    Select * FROM Search WHERE[LastName] Like '**'

  4. #19
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214
    Then this message came up when I put it in a new query like you suggested..
    Attached Thumbnails Attached Thumbnails Capture6.PNG  

  5. #20
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You only tried to run the search once or 4 times? The first query show looks valid. The others will probably just return all records.

  6. #21
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214
    I tried it 4 times then. That included me clearing it to see what happened. I tried it again this morning and it just returns all values...any idea on why if the first query looks valid?

  7. #22
    cbrsix is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    214
    I want to thank you for your help..I figured it out. My field names were not spelled correctly. When I originally created the database, I had put spaces in the field names, I thought that I went through and corrected all of them to have no spaces, but apparently I forgot to update these fields. Dumb mistake.

  8. #23
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You're welcome. I'm glad you got it figured out.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-20-2012, 03:16 AM
  2. Replies: 12
    Last Post: 03-22-2012, 02:48 AM
  3. Replies: 7
    Last Post: 11-16-2011, 01:22 PM
  4. Replies: 9
    Last Post: 02-15-2011, 03:05 PM
  5. Search box on a form.
    By annaisakiwi in forum Forms
    Replies: 3
    Last Post: 01-02-2011, 08:39 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