Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log open/close of external file

Status
Not open for further replies.

mustangcoupe

Technical User
Feb 26, 2003
221
US
I would like to log the time a file is open/closed in my database. (I intend to have the user open the file with a link from access.) So logging the open time is no problem. But I'd like to know when they closed it (for project time tracking) can this be done? watching a file that was opened with access from my form and logging the close time?

--Todd


TechnicalUser pretending to be a programmer(shhh… the boss doesn’t know yet)
 
Something like this ?
OpenTime = Now()
Set Sh = CreateObject("WScript.Shell")
Sh.Run Chr(34) & strPathOfFile & Chr(34), 3, True
CloseTime = Now()
Set Sh = Nothing

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I'll have to look at it... I will post my results back


--Todd


TechnicalUser pretending to be a programmer(shhh… the boss doesn’t know yet)
 
ok, I have tried it...

I modified your code as follows...
but I get an error number 3061 to few par. expected 1... (I have an autonumber field in this table called rptLogID I think this is where it is screwed up... how would I populate it also.)


Code:
Private Sub rptLocation_Click()
Dim intReturn As Integer
Dim opentime As Variant
Dim closetime As Variant
Dim sh As Variant
intReturn = IsSomethingInControl(Me.rptLocation)
If intReturn = False Then
    Call browse_for_report_Click
Else
opentime = Now()
Set sh = CreateObject("WScript.Shell")
sh.Run Chr(34) & Me.rptLocation & Chr(34), 3, True
closetime = Now()
CurrentDb.Execute "Insert Into tbl_reportlog (JobID, open, close, networkuser) VALUES (forms!jobform!jobid, '" & opentime & "', '" & closetime & "', '" & user & "');"
Set sh = Nothing
'Application.FollowHyperlink Me.rptLocation, , True

End If
End Sub


--Todd


TechnicalUser pretending to be a programmer(shhh… the boss doesn’t know yet)
 
Replace this:
CurrentDb.Execute "Insert Into tbl_reportlog (JobID, open, close, networkuser) VALUES (forms!jobform!jobid, '" & opentime & "', '" & closetime & "', '" & user & "');"
By this:
CurrentDb.Execute "Insert Into tbl_reportlog (JobID, open, close, networkuser) VALUES ([highlight]" & [/highlight]Forms!jobform!jobid[highlight] & "[/highlight], '" & opentime & "', '" & closetime & "', '" & user & "');"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I was so close yet so far!!! Thanks agian...



--Todd


TechnicalUser pretending to be a programmer(shhh… the boss doesn’t know yet)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top