X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> Dlookup Adds A Question Mark, Access 2016    
post Oct 12 2019, 03:16 AM

Posts: 179
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.

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:


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.

Go to the top of the page
Start new topic
post Oct 12 2019, 04:12 AM

Posts: 1,527
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
post Oct 12 2019, 04:49 AM

Posts: 179
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
Go to the top of the page

Posts in this topic

Custom Search

RSSSearch   Top   Lo-Fi    4th April 2020 - 11:37 PM