hello, how to validate if an .IMD file is found in the working project directory to send a message to the user who must first verify that this file exists and then proceed with the execution of the tests.
ortizmario6025@...
Offline
Last seen: 3 weeks 3 days ago
Joined: 09/03/2021 - 11:54
There are different ways you can do this, these example tries to open the file and then checks for an error. If the file doesn't exist then IDEA throws an error which we capture and know that the file doesn't exit.
Thank you, Brian Element.
thank you very much for your help, sincerely with what I have learned from you, there is no way to thank you, it has even encouraged me to learn a little VB to apply it in my scripts
Glad you find the site helpful. It is always nice when someone comes back and says that my suggestion helped them out. I apprecaite that.
Cheers,
I execute the program and I place a table that exists and another that does not exist and it always throws me false, what will be happening? Here is the code.
Sub Main
MsgBox checkIfIMDFileExists("This file doesn't exist.IMD")
End Sub
Function checkIfIMdFileExists(sFilename As String) As Boolean
Dim db As database
On Error Resume Next
client.OpenDatabase("MOVI.CONTABLES.IMD")
'client.OpenDatabase(sFilename)
If err.number <> 0 Then
checkIfIMdFileExists = False
err.number = 0
Else
checkIfIMdFileExists = True
End If
End Function