I have run into trouble with an Access database. I didn't build this database I am merely trying to get it running for our office because we really think it could benefit us.
I created a shorter version of the VBA code that is giving me trouble so I can troubleshoot it. What it is trying to do is create a recordset with 1 record, then based off a value in that one record, check to see if a folder exists.
The above code give me the “Missing File” end result
However when I copy the value directly from the table and insert it in the code in place of the variable - If FS.FolderExists( “F:/location”) I get the success scenario.
Lastly, the value in the table is set to a text field, so that should mean it is a string. Can anyone explain what the issue is? This apparently worked at one point..
Thanks for your extra set of eyes,
~Kit
I created a shorter version of the VBA code that is giving me trouble so I can troubleshoot it. What it is trying to do is create a recordset with 1 record, then based off a value in that one record, check to see if a folder exists.
Code:
[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Private Sub Command91_Click()
Dim rst As Recordset, FS
Set rst = DBEngine(0)(0).OpenRecordset("SELECT * FROM [Settings] WHERE [SettingsProfile] = """ & Forms![Switchboard]![ProfileNameSelect] & """")
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FolderExists(rst!ArchiveLocation) = False Then
MsgBox "The path specified in your Preferences profile does not exist anywhere on your system. Please correct this in your Preferences profile and try again.", vbCritical + vbOKOnly, "Missing File"
Else
MsgBox "Success!"
End If
End Sub[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]
The above code give me the “Missing File” end result
However when I copy the value directly from the table and insert it in the code in place of the variable - If FS.FolderExists( “F:/location”) I get the success scenario.
Lastly, the value in the table is set to a text field, so that should mean it is a string. Can anyone explain what the issue is? This apparently worked at one point..
Thanks for your extra set of eyes,
~Kit