UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Dlookup Adds A Question Mark, Access 2016    
 
   
andywal6
post Oct 12 2019, 03:16 AM
Post#1



Posts: 169
Joined: 11-January 08



Hi Al

I'm using the code below to check if a Folder exists, and if not, create one, but for some reason the DLookup adds a '?' to the beginning of the result.

CODE
Debug.Print DLookup("[FoldersLocation]", "Company")
    If Dir(DLookup("[FoldersLocation]", "Company") & "\" & Forms![HostData]![HostID], vbDirectory) = "" Then
    MkDir (DLookup("[FoldersLocation]", "Company") & "\" & Forms![HostData]![HostID])
    End If


The 'IF Dir' line causes an error which says " Bad File name or number "
I put the Debug line to check and its result is:

?C:\UKGuardiansDB\HostFolders

Which is correct except for the question mark in front which incidentally, is not in that table field .
The [HostID] comes up with the correct result

Any thoughts would be appreciated.

Andy.......
Go to the top of the page
 
arnelgp
post Oct 12 2019, 04:12 AM
Post#2



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


just maybe there are non-printable characters in your FolderLocation field.
try deleting the record and type again the location in that field.

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 
andywal6
post Oct 12 2019, 04:49 AM
Post#3



Posts: 169
Joined: 11-January 08



Hi arnelgp

Many thanks for your observation, you were quite correct.

This come from being lazy and copying the address from the folders Properties.

Best regards
Andy.......
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    8th December 2019 - 11:39 PM