Check if folder path exists

P

PsyberFox

Hi there,

I have a browse button to search for a folder path - working great!

1.
However, the user can obviously enter a path manually into a text field
(preceding the browse button). How can I check whether this path actaully
exists before saving the record?

2.
While I am on that subject, is there a way to prevent a user from tabbing
past the last field of an input form? I don't want the input form to display
a new record after a user has pressed tab on the last field...

Thank you in advance,
 
D

Douglas J. Steele

Assuming the folder path is in variable strPath, Len(Dir(strPath,
vbDirectory)) will return 0 if the folder does not exist (and non-zero if it
does)
 
L

.Len B

1.
Dim strFile As String
strFile = "C:\Temp\123.txt"

If Dir(strFile) = "" Then

MsgBox strFile & " doesn't exist"

Else

MsgBox strFile & " exists"

End If

2.
Use form's BeforeUpdate event. There you can perform data validation and
not save or save and close the form as necessary.

--
Len
______________________________________________________
remove nothing for valid email address.
| Hi there,
|
| I have a browse button to search for a folder path - working great!
|
| 1.
| However, the user can obviously enter a path manually into a text field
| (preceding the browse button). How can I check whether this path
actaully
| exists before saving the record?
|
| 2.
| While I am on that subject, is there a way to prevent a user from
tabbing
| past the last field of an input form? I don't want the input form to
display
| a new record after a user has pressed tab on the last field...
|
| Thank you in advance,
| --
| The Psyber Fox
| http://www.psyberconsulting.co.za
 
J

John Spencer

To stay on the same record
Set the form's Cycle property to Current Record.

The use could still move to a new form using the mouse or other methods but
TABBING through the controls will keep you on the same record.


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top