quick question

binghamw

BingleyW
Local time
Today, 00:02
Joined
Apr 22, 2004
Messages
57
Hi,
I have two text boxes:

txtFile and txtDatepost

In the textbox txtFile, the user browses to find a file in a drive. The selected file and path name is then displayed in the txtFile.

In txtDatepost I have put into the control source:

=Filedatetime [txtFile]

which works fine. However, when the form pops up, if there is no file selected in txtFile, the date in txtDatepost doesn't show as blank, it shows as #error. After a file is selected and shows in txtFile, the date shows up.

What I would like to see happen is the filedatetime function to show up ONLY after a file is selected.

Any ideas?

Thanks
 
Something like:

=IIF(IsNull([txtFile]),"-",=Filedatetime([txtFile]))
 
Mile, the strange thing I found about the FileDateTime function is that it will produce a "File not found" error even if it should not be evaluated, as is the case with the structure you posted. We'll see if the user can get it to work.

I was going to propose that the user used some code in the Open event of the form and the After Update event of the txtFile textbox to set the value of the txtDatepost textbox. Something like what you proposed, just in code form:
Code:
If IsNull(Me.txtFile) Then
    Me.txtDatepost=""
Else
    Me.txtDatepost=FileDateTime(Me.txtFile)
End If
 
Well Actually I tried both.

Did you mean for me to put that code in the OnOpen AND AfterUpdate event? I did both and nothing shows up after I select a file.
 
For some reason it wouldn't show up in the after update event of the text box.
So I added to the end of the code of the browse button.


Thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom