Solved Multiple search engine with dropdowns

I have not fully tested that code. You need to make a string with all Spanish characters that are not accepted in Access SQL. Use that to test.
For the international characters it should replace with the appropriate non accent. You may need to tweak my numbers
This shows the Ascii code and the symbol.
So for ecample 183 should become 65
 
If your file names are really like this
Unicode.jpg


Look at 41. The #, N with tilde, and all the symbols need special handling to be handled by access sql I no of no way to search for that file name unless I replace all of those characters with something. I do not know a rule to apply to the symbols so I replace them all with a uncommon character.
 
I do not know if it has not occurred to end the emojis do it to the beast. I mean: instead of locating what needs to be replaced, allow what you do want to be and in a Case Else replace the rest with a "".

That is what I did in this query. What happens is that, when it reaches the one to be replaced, it stops, and I don't know how to put it in code so that it continues.

The function is called CleanString.
 

Attachments

I do not understand the purpose of cleanstring. Redundant and not needed.
Code:
Public Function ReplaceInternationalCharacters(ByVal strText As String) As String
    
    Dim i As Integer
    'Big A
    For i = 192 To 197
            ReplaceInternationalCharacters = Replace(strText, Chr(i), "A")
    Next i
    'little A
     For i = 224 To 229
       ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), "a")
    Next i
    'Big E
     For i = 200 To 203
            ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), "E")
    Next i
    'little e
    ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(130), "e")
     For i = 232 To 235
       ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), Chr(101))
    Next i
    'Big I
    For i = 204 To 207
            ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), "I")
    Next i
    'little i
     For i = 236 To 239
       ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), "i")
    Next i
    'Replace Big O
    For i = 210 To 214
       ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), "O")
    Next i
    'Replace little o
    For i = 242 To 248
      ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), "o")
    Next i

    'Replace Big U
    For i = 217 To 220
       ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), "U")
    Next i
    'Replace little u
    For i = 249 To 252
      ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(i), "u")
    Next i

    'Replace Big Y
       ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(152), "y")
       ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(236), "y")
    'Replace Big N
    ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(209), "N")
    'Replace little N
    ReplaceInternationalCharacters = Replace(ReplaceInternationalCharacters, Chr(241), "n")
    End Function
Public Function ReplaceSpecialCharacters(ByVal strText As String, Optional ReplaceChar As String = "_")
   Dim i As Integer
   ReplaceSpecialCharacters = strText
   'Need to make a decision if you want to replace ' with '' or get rid of it.
   'Depends on how you want to use it
   ReplaceSpecialCharacters = Replace(ReplaceSpecialCharacters, "'", "")
   ReplaceSpecialCharacters = Replace(ReplaceSpecialCharacters, "#", "_No_")
End Function

'Public Function ReplaceUnicodeCharacters(txt As String) As String
'    Dim regEx As Object
'    Set regEx = CreateObject("vbscript.regexp")
'    regEx.Pattern = "[^\u0000-\u007F]"
'    ReplaceUnicodeCharacters = regEx.Replace(txt, "~")
'End Function
Public Function ReplaceUnicodeCharacters(txt As String) As String
  Dim i As Integer
  Dim out As String
  For i = 1 To Len(txt)
    If AscW(Mid(txt, i, 1)) < 256 And AscW(Mid(txt, i, 1)) > 31 Then
      out = out & Mid(txt, i, 1)
     End If
  Next i
  ReplaceUnicodeCharacters = out
End Function

Public Function ReplaceBadCharacters(ByVal strTxt As String) As String
   ReplaceBadCharacters = strTxt
   ReplaceBadCharacters = ReplaceInternationalCharacters(ReplaceBadCharacters)
   ReplaceBadCharacters = ReplaceSpecialCharacters(ReplaceBadCharacters)
   ReplaceBadCharacters = ReplaceUnicodeCharacters(ReplaceBadCharacters)
End Function
CVideosMajP CVideosMajP

NombreNombre1
¿QUÉ HE HECHO? 🙈 🙈 🙈 GEORGIA EN FURGO #2¿QUE HE HECHO? GEORGIA EN FURGO _No_2
Bikecanine, si sabes como me pongo... ¿pa qué me invitas_ _ TWT Late night 05Bikecanine, si sabes como me pongo... ¿pa que me invitas_ _ TWT Late night 05
🔊¿No ENTIENDES el INGLÉS_ _ 🙋🏻‍♂️ Mejora tu LISTENING _ 🧑🏻‍🎓Comprende a los NATIVOS en INGLÉS¿No ENTIENDES el INGLES_ _ Mejora tu LISTENING _ Comprende a los NATIVOS en INGLES
¿Por qué llevo a HIPPIE en una MOCHILA_ ⚠️ 5 MOTIVOS¿Por que llevo a HIPPIE en una MOCHILA_ 5 MOTIVOS
NERVIOS en el PREPARADOR 🤯 ¿es normal_ ¿cómo gestionarlo_ Os cuento mi experienciaNERVIOS en el PREPARADOR ¿es normal_ ¿como gestionarlo_ Os cuento mi experiencia
¡¿CÓMO SE LAS ARREGLA BEA DE VERDE POR DENTRO VIAJANDO SOLA EN SU FURGONETA_! _D¡¿COMO SE LAS ARREGLA BEA DE VERDE POR DENTRO VIAJANDO SOLA EN SU FURGONETA_! _D
📒 The word WAY_ ¿Sabes cómo usarla en inglés_ 🤓 The word WAY_ ¿Sabes como usarla en ingles_
📺 Aprende INGLÉS con FRIENDS _ 👂 ¿Entiendes lo que dicen_ Aprende INGLES con FRIENDS _ ¿Entiendes lo que dicen_
¿Qué está pasando aquí_ _ Resolviendo dudas¿Que esta pasando aqui_ _ Resolviendo dudas
[DIRECTO] ¿Nos ponemos al día_ 🚐 CONEXIÓN FRANKY - preguntas y respuestas[DIRECTO] ¿Nos ponemos al dia_ CONEXION FRANKY - preguntas y respuestas
🗣 WHY vs BECAUSE _ 🤓 ¿Los diferencias en INGLÉS_ _ 🤔 ¿Sabes cómo usarlos_ WHY vs BECAUSE _ ¿Los diferencias en INGLES_ _ ¿Sabes como usarlos_
FV11# ¿Cómo VOY al BAÑO_💩 Un día cualquiera en mi FURGONETA _ Parte 3 de 3_ VANLIFE VIAJAR SOLAFV11_No_ ¿Como VOY al BANO_ Un dia cualquiera en mi FURGONETA _ Parte 3 de 3_ VANLIFE VIAJAR SOLA
✅ 20 PHRASAL VERBS con ON _ ¿Te los sabes todos_ _20 verbos frasales con ON 20 PHRASAL VERBS con ON _ ¿Te los sabes todos_ _20 verbos frasales con ON
Querida Navidad... ¿Qué me traes? - ¡Montando el árbol más grande! - Vanesa Romero TVQuerida Navidad... ¿Que me traes? - ¡Montando el arbol mas grande! - Vanesa Romero TV
LOTERIA DE NAVIDAD ¿Y SI CAE AQUÍ? | 2X02 INSERT COINLOTERIA DE NAVIDAD ¿Y SI CAE AQUI? | 2X02 INSERT COIN
📺 Aprende INGLÉS con THE SIMPSONS _ 👂 ¿Entiendes lo que dicen_ Aprende INGLES con THE SIMPSONS _ ¿Entiendes lo que dicen_
¡OS PRESENTO A PIZZA! 🍕 ¿y ahora qué_¡OS PRESENTO A PIZZA! ¿y ahora que_
Nuestra furgo vuelve a arrancar. ¿Qué le pasaba_ - VIVIR Y VIAJAR EN FURGONETA CAMPER cap. 2Nuestra furgo vuelve a arrancar. ¿Que le pasaba_ - VIVIR Y VIAJAR EN FURGONETA CAMPER cap. 2
¿😱CÓMO SER MÁS PRODUCTIVA 😱_Mis TIPS de organización#orden #organizarmitiempo #productividad #noesad¿COMO SER MÁS PRODUCTIVA _Mis TIPS de organizacion_No_orden _No_organizarmitiempo _No_productividad _No_noesad
MIS PROPÓSITOS PARA 2021 _ ¿Nuevo libro_¿Seguiré leyendo a Agatha_MIS PROPOSITOS PARA 2021 _ ¿Nuevo libro_¿Seguire leyendo a Agatha_
VLOG DIARIO⚡️Un DÍA CONMIGO 🤩 estudiando una oposición _ RUTINA DIARIA ¿Cómo es un día opositando_VLOG DIARIOUn DIA CONMIGO estudiando una oposicion _ RUTINA DIARIA ¿Como es un dia opositando_
🚐¿Cómo es VIVIR en una furgoneta CAMPER y CUÁNTO cuesta_💰😮¿Como es VIVIR en una furgoneta CAMPER y CUÁNTO cuesta_
🔔 Las 5 CLAVES para aprender VOCABULARIO en INGLÉS _ 😵 ¿No recuerdas las palabras en inglés_ Las 5 CLAVES para aprender VOCABULARIO en INGLES _ ¿No recuerdas las palabras en ingles_
18 ¿Quién me pone la pierna encima_18 ¿Quien me pone la pierna encima_
01 ¿Quién puede matar a un cerdo_01 ¿Quien puede matar a un cerdo_
16 ¿Tú te crees que la policía es tonta_16 ¿Tu te crees que la policia es tonta_
21 ¿Tú te afeitas, Guille_21 ¿Tu te afeitas, Guille_
22 Pero, ¿quién mató a padre_22 Pero, ¿quien mato a padre_
😷 ¿Son seguras las mascarillas de tela ¿Son seguras las mascarillas de tela
 
4. If these folders stay the same but periodically files are added, deleted then I would definitely not reload as we do now. I did this for simplicity. Especially would not do this if we are talking a large number of files and folders. Currently we delete all records and reload. This is slow and inefficient, but if it is a small directory then it may not matter. The constant deleting bloats the database and requires a compact and repair after every time this is done.
Instead once the directory has been spanned, the next "refresh" I would not delete the records and reload. As you span you check if the file is in the table. If not only then do you add it. I would add another boolean field marking it as "Found" and update that. Now you would know what fields were not found, these are the fields that were deleted from the directory. You can do a simple delete query for those.

I have reached a point that I do not know how to follow because I get an error with the TreeView that I do not know how to fix.

Let's see, I have tweaked the function to clean the titles, and it is without any strange characters. You can see it in the attached database. You have used a function for the images that I had also found, but it gave me an error and I did not know how to solve it. That's why I did what I happened to you.

The following has been to apply what you explain in point 4 that I refer to in this post.

Basically what I have done has been that when starting the FDirectory form it does not update any data, only that it starts the tree with the data that there was. If there are not, nothing happens: you update and it is filled.

It also does not load or update if you have gone to the form to set the default folders and have returned to the form with the tree. You have to update.

The problem is that, when updating a second time, it gives an error. It says "Object variable or with block not set." It may be silly, but I don't know where the error is.

I think that since I have left it, it works a lot better.

I await your comments and suggestions.

Thank you.
 

Attachments

Another thing that is not clear to me is if, as I have it mounted, it will know how to differentiate between the newly added files, those that I have deleted, those that I have been able to move from a folder and those that may be repeated.
 
I have fixed a bug I had made while expanding the treeview, but it still doesn't work when:

1. Clear all data.
2. You enter the treeview, change folder and update.
3. Update again and give the failure.

I record a video to see the failure.

 

Attachments

I have taken the database that does work, and little by little I have added the changes I made. And something I have had to do wrong in mdlSpanFoldersAndFiles that gives error. @MajP could you look at it?
 

Users who are viewing this thread

Back
Top Bottom