The images i sent awhile ago with a highlights of yellow that what it pop-up when i click the button sir andy49
The images i sent awhile ago with a highlights of yellow that what it pop-up when i click the button sir andy49
maybe the proper calling of the module which i name it ResursiveDir
Sir andy49,
I still have error when i run compile and is referring to the bold word in the code i posted
Code:Private Sub cmdgetfil_Click() Dim colFiles As New Collection Dim direc As String Dim filetosearch As String filetosearch = Me.RfiNo 'you may need to add & ".pdf" onto the filetosearch line if the combobox doesn't have .pdf in it direc = "\\106.154.208.10\qaqc\011. RFI&RRI PDF FILES\02. RFI" RecursiveDir colFiles, direc, filetosearch, False Dim vFile As Variant For Each vFile In colFiles OpenAnyFile (vFile) Next vFile 'keep as false for a few tests so it only looks in your current folder End Sub Function OpenAnyFile(strPath As String) If FileThere(strPath) Then FollowHyperlink strPath Else MsgBox ("File not found") End If End Function Function FileThere(FileName As String) As Boolean If (Dir(FileName) = "") Then FileThere = False Else: FileThere = True End If End Function Private Sub Form_Open(Cancel As Integer) Dim ID_Arg As Long ' load the openarg into the local variable id_arg ID_Arg = Nz(Form_InspectionDetailsfrm.OpenArgs, 0) ' check to see if the id_arg is not zero. If not zero then we need to filter to select NCRecId If ID_Arg <> 0 Then ' ok we have a GC_ID so lets filter! Me.Filter = "SeqId=" & ID_Arg Me.FilterOn = True End If End Sub
Did you get my private message kirky
Sent from my iPhone using Tapatalk
I received your message sir andy49 and thank you so much for guiding me....
I was able to run it but it will not search for a file in subfolders where the pdf is located.
I want to make it clear, the code actually working now and i tested it already using the full path where the pdf is located.
But when i try to change the path putting the main folder only it wont work searching the pdf file inside the sub-folders
Full path of the pdf file matching the textbox RfiNo ----------------\\106.154.208.10\qaqc\011. RFI&RRI PDF FILES\02. RFI\01. CIVIL\07. SAMSUNG\RO Area
I want it sir andy49 to search and open pdf file inside the subfolders using the path of of main folder only if this one is possible.
Thank you sir andy49
Can you remove the ' from the line above in the recursiveDir function and then run it. Check in the immediate window and report back with what it saysCode:'Debug.Print strFolder
sorry sir andy49 for late reply, I was busy with my work...
the code actually working for specific folder only where the file is located and not searching recursively into subfolders.
Aside from that if the file not found the msgbox does not appear.
Ok
Can you replace this line
with the lineCode:'Debug.Print strFolder
Run the program again and send me a copy of exactly what the messagebox says please when it opensCode:msgbox strFolder
Thanks kirky. I'm sorry it's taking a while. The msgbox seems good. I wondered if the file you are searching for is actually in a sub folder or if it's in the main folder.
Sent from my iPhone using Tapatalk
Sir andy49,
I ill try at home again the code. Thank you so much no words can i say... im really new to access vba and all i have to do know is just gather information to what i want to achieve in my database. I feel so excited to know more about it.
Thank you so much
I'm working at present. It's top priority for me over the weekend.
Sent from my iPhone using Tapatalk