Results 1 to 11 of 11
  1. #1
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138

    how to use wildcards

    I want to use wildcards on these textboxes (4 of them)(BergPiek,Bergreeks,Provinsie and Land), only using one Search button "Soek Berg Naam" ,I want it to search only for 3 word and more eg. ?ea? must give me 4 words with letters e and a for second and third letters eg in the bottom part. Is this possible, and is there a sample of this.


    Click image for larger version. 

Name:	2019-08-12 13_30_08-Window.jpg 
Views:	20 
Size:	116.4 KB 
ID:	39406

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Are you using a dynamic parameterized query? Or are you using VBA to build filter criteria?

    A query could be like:

    SELECT * FROM table WHERE BergPiek LIKE "*" & Forms!formname.BergPiek & "*" AND Bergreeks LIKE "*" & Forms!formname.Bergreeks & "*" & AND Provinsie LIKE "*" & Forms!formname.Provinsie & "*" AND Land LIKE "*" & Forms!formname.Land & "*";
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Hendrik,

    See this from M$oft re wildcards.
    You have example usage in the crossword database I sent previously.

    Good luck.

  4. #4
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    Orange, I did try your info that you have send me, but got stuck at this line, see my code

    Code:
    Me.lstResults.RowSource = "Select Bergpiek FROM Berge " _
                  & " where BergPiek Like '" & Forms!Berge!TXTBergpiek & "'" _
                  & " AND fIncludeWord = 0 "
    I am not sure what to use instead of Me.lstResults.RowSource =. I have all the fileds in the table and on the form see screeshot

    Click image for larger version. 

Name:	2019-08-12 15_27_06-Access - Woord Soek _ Database- D__html_Database_test_Woord Soek.accdb (Acce.jpg 
Views:	19 
Size:	76.9 KB 
ID:	39408

    Click image for larger version. 

Name:	2019-08-12 15_26_39-Access - Woord Soek _ Database- D__html_Database_test_Woord Soek.accdb (Acce.jpg 
Views:	19 
Size:	55.9 KB 
ID:	39409

    Click image for larger version. 

Name:	2019-08-12 15_26_18-Microsoft Visual Basic for Applications - Woord Soek - [Form_Berge (Code)].jpg 
Views:	20 
Size:	178.8 KB 
ID:	39410

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    In the code I sent to you:
    -in form design view go to the code foor the search button
    -put a breakpoint on the Me.lstResults.Rowsource..... line
    -go to form view
    -run the code to the breakpoint
    -then in the immediate window put ?TXTBergpiek

    Here are 2 graphics from my database.

    The contents of the searchtext box
    Click image for larger version. 

Name:	formcontents.PNG 
Views:	19 
Size:	37.1 KB 
ID:	39412

    the use of the immediate window
    Click image for larger version. 

Name:	forHendrik0.PNG 
Views:	19 
Size:	33.4 KB 
ID:	39413

    Note the value in the textbox includes the "*".

    Perhaps I'm not following your requirement. I am leaving to play golf, but will be back later today.

  6. #6
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    Orange

    Enjoy your golf


    As you can see in my form I have a few textboxes, the ones that I want to use is Bergpiek,bergreeks,provinsie and land.
    on the buttonSoek berg naam, when I search for a word Bergpiek only it must use wildcards, when find the word or words, it must display it in the bottom, If I search bergreeks and the others the same must happen.

    I have tryied it as you can see, but I do not know how to work the last code of yous, as you can see in top picture.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Assuming users are NOT typing * into textboxes, include * in the code.
    Code:
    Me.lstResults.RowSource = "Select Bergpiek FROM Berge " _
                  & " where BergPiek Like '*" & Forms!Berge!TXTBergpiek & "*'" _
                  & " AND fIncludeWord = 0 "
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Hi again Hendrik,
    I have returned from golf.
    Tonight, I'll look at the database you sent and try to create a sample for you. But I do not use macros, I use vba.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Hendrik,
    Please describe the rules again.
    Here is my understanding:
    -4 textboxes are available (BergPiek,Bergreeks,Provinsie and Land )
    -only 1 textbox can be filled for each search attempt, but it could be any of the 4 textboxes
    -You enter a string of chars and wildcards as appropriate
    -you click the button
    -check textboxes for a string to search
    -error if no textbox has a string---exit routine
    -search table Berge for the string

    Update: Hendrik
    I took data from your previous database and added a form with a listbox.
    You can search with wildcards on any one of your textboxes. At least 1 textbox must be populated.
    If more than 1 are populated, then it takes the first one from the top to do the search.
    The results are placed in the listbox. A count of found records is above the listbox.
    I renamed the buttons for my convenience.
    Some of your data have trailing spaces in the names, so do not get searched properly.
    Try piek with a*o as search. Then look in table Berge and see the records a...o (followed by space).

    Good luck.
    Attached Files Attached Files
    Last edited by orange; 08-12-2019 at 08:32 PM.

  10. #10
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    Orange
    Thank you will look at it today, you are very helpfull, and I begning to understand some of it now.

  11. #11
    hendrikbez is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    138
    Thank you orange, just need help on one more thing, going to make new post

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

Similar Threads

  1. wildcards
    By THOMASM4425 in forum Access
    Replies: 1
    Last Post: 04-29-2014, 04:06 PM
  2. VBA Wildcards
    By dssrun in forum Programming
    Replies: 11
    Last Post: 03-31-2011, 08:44 AM
  3. SQL Wildcards
    By sandlucky in forum Queries
    Replies: 4
    Last Post: 03-28-2011, 03:31 AM
  4. Using wildcards (*) in SQL
    By SIGMA248 in forum Queries
    Replies: 1
    Last Post: 07-22-2010, 08:44 PM
  5. Wildcards?!
    By esx_raptor in forum Access
    Replies: 3
    Last Post: 02-19-2010, 03:22 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