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
> Log Usage Of Forms And Reports, Access 2007    
 
   
phil_andre
post Jan 1 2018, 04:08 AM
Post#1



Posts: 212
Joined: 7-December 16



Dear Support Team,

Happy New Year!


May i ask your kind usual support please to create a module and table that can automatically log all the forms and reports when the users opened.

Please download the attached sample which i've found from google search... almost the same i need but the problem on this sample is i have to add in property on all my forms and reports on below expression which is nightmare for me, i have almost hundred forms it takes a lot of time.

Property For a form For a report
On Open =LogDocOpen([Form]) =LogDocOpen([Report])
On Close =LogDocClose([Form]) =LogDocClose([Report])

Therefore, i am here for support it this can be done on module that can apply automatically in public without setting each form and report properties.

A big thanks in advance to all..

Phil.

Attached File(s)
Attached File  LogFormReportUse.zip ( 20.7K )Number of downloads: 10
 
Go to the top of the page
 
Jeff B.
post Jan 1 2018, 06:46 AM
Post#2


UtterAccess VIP
Posts: 10,065
Joined: 30-April 10
From: Pacific NorthWet


Actually, folks here on UA are unpaid volunteers, not support staff. (hey, wait, is everyone else getting paid?!?)

JOPO (just one person's opinion) -- one way or the other, I believe you'll need to visit each form and report that you want to log, even if you're only telling it (each one) to do the logging. Else, how would the procedure "know" that a form/report had been opened/closed?

--------------------
Regards

Jeff Boyce
Microsoft Access MVP (2002-2015)

Mention of hardware or software is, in no way, an endorsement thereof. The FTC of the USA made this disclaimer necessary/possible.
Go to the top of the page
 
GroverParkGeorge
post Jan 1 2018, 08:20 AM
Post#3


UA Admin
Posts: 33,034
Joined: 20-June 02
From: Newcastle, WA


Jeff's right.

Please search the archives here. You should find several examples of logging and auditing. One or more should be reasonably close to what you need, and you can pick one to adapt to suit your needs.

Here's a sample db that includes an audit function, which you could modify to simply log form and report open and close events.
This post has been edited by GroverParkGeorge: Jan 1 2018, 08:30 AM

--------------------
Go to the top of the page
 
ScottGem
post Jan 1 2018, 01:17 PM
Post#4


UtterAccess VIP / UA Clown
Posts: 32,210
Joined: 21-January 04
From: LI, NY


Phil,

I didn't download the sample, but I can see what's happening.

The sample you downloaded has 2 custom functions LogDocOpen and LogDocClose. Each of those functions take a parameter which is the name of the object you are logging. However this is NOT very difficult. I can show you how to do it easily.

1) Create a table; call it tblActivityLog. The fields would be ActivityLogID (PK autonumber, UserID, Objectname, TimeStamp, ActivityType)
2) in the On Load event of each form and report that you want to log add this line of code:

CurrentDB.Execute "INSERT INTO tblActivityLog (UserID, ObjectName, TimeStamp, ActivityType) VALUES('" & Environ("Username") & "', " & Me.Name & ", #" & Now() & "#, 'O');"

3) in the On Close event, use the same code except change the O to C.



--------------------
Scott <>
Scottgem's Blog
Microsoft Access MVP since 2007
Author: Microsoft Office Access 2007 VBA
Go to the top of the page
 
theDBguy
post Jan 1 2018, 02:27 PM
Post#5


Access Wiki and Forums Moderator
Posts: 72,745
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Re: "...the problem on this sample is i have to add in property on all my forms and reports on below expression which is nightmare for me..."

Take a look at my blog article where I showed how to modify the Ribbon property of all the reports in the database. One user also submitted a comment showing how to modify all forms in the database.

I am hoping it will give you an idea how to update all your database objects with ease.

Good luck!

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
phil_andre
post Jan 1 2018, 02:57 PM
Post#6



Posts: 212
Joined: 7-December 16



Thanks to all for the reply.

@Mr. Jeff, anyway, thank you.

@Mr. George, thanks for the sample, but i didn't find the log table for the forms and reports when opened and closed. But i found one module that you called it a public property then call but am still figuring out about you said.

@Mr. Scott, thanks, but it is similar in my attached demo which need to be apply in event procedure in each form and report name.

@Mr. DB, thanks but what i seen in your website is different scenario about form modification / ribbon.

Correct me if am wrong, if this can be done by creating a module with public property then call the other module command that can update the table log of form name and report name when it was opened and closed by username.

Actually attached demo is fine, am just figuring out why i can't create a public function supported with call function , instead of doing one by one on the form and adding two parameter/call in event procedure,
Go to the top of the page
 
theDBguy
post Jan 1 2018, 03:01 PM
Post#7


Access Wiki and Forums Moderator
Posts: 72,745
Joined: 19-June 07
From: SunnySandyEggo


Hi,

I didn't look at the database you uploaded and just went with the description you provided. You said it works as you wanted except you have to modify all your forms and reports to add properties for the technique you found to work with your own database. You also said modifying all your forms and reports is a problem because there's a lot of them.

What I gave you is a technique to modify all your forms and reports very quickly, so you can add those properties without any problem. My example shows how to modify the Ribbon property. You should be able to use the same technique to add the properties you need for the audit function.

Does it make sense?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
phil_andre
post Jan 1 2018, 03:03 PM
Post#8



Posts: 212
Joined: 7-December 16



Please, kindly download to see what exactly it is.
Go to the top of the page
 
theDBguy
post Jan 1 2018, 03:16 PM
Post#9


Access Wiki and Forums Moderator
Posts: 72,745
Joined: 19-June 07
From: SunnySandyEggo


Hi Phil,

I downloaded your demo and it seems you got it from Allen Browne's website here. It is common courtesy to post a link to the source rather than taking the downloaded demo and attaching it here. This is to give the original author the credit for his or her work, which they freely shared with all of us.

After looking at it, it is no different than any other audit samples, like the one George posted, where you would call a function to record the audit trail into a table.

So, the problem is how to modify all your database objects to make the function call? What I gave you is one way to do it.

If you find another technique where it would not require to modify all your existing objects to make the function call, please share it with us. Otherwise, how would the function know which form or report is being opened or closed?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
phil_andre
post Jan 1 2018, 03:30 PM
Post#10



Posts: 212
Joined: 7-December 16



Thanks Mr. DB, i thought that posting a link is not allowed that's why i attached that sample here.

And sure will let you know once it is found in my research.

DB, do you mean that we can add this call in one time to all my form and report objects.

If yes, then can you please update the sample with one more form,,,

Go to the top of the page
 
theDBguy
post Jan 1 2018, 04:28 PM
Post#11


Access Wiki and Forums Moderator
Posts: 72,745
Joined: 19-June 07
From: SunnySandyEggo


Yes, that is exactly what I was saying. You can use the technique I demonstrated in my blog to add the function call to all your forms and reports in one shot.

Modifying the demo you posted does not make sense because it does not contain all your forms and reports that need to be modified to add the needed properties.

What part of the blog article are you having problems implementing? The function in the blog article is very simple. Once you create it, you just need to execute it once and you're done! It will modify all your forms and reports to add the properties you need. As a result, you should have an audit log feature in your database to track who is opening and closing all your forms.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
theDBguy
post Jan 1 2018, 04:31 PM
Post#12


Access Wiki and Forums Moderator
Posts: 72,745
Joined: 19-June 07
From: SunnySandyEggo


PS. The issue with links and attachments...

You are not allowed to post a link to your own database demo file for download. Even if you have modified Allen Browne's demo and posted it as an attachment, it is still common courtesy to post a link to the source where you got the original idea.

Hope this helps clarify the forum guidelines...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
phil_andre
post Jan 1 2018, 10:17 PM
Post#13



Posts: 212
Joined: 7-December 16



Good Morning!

I got you DB, you are right. thanks to all and Mr. Allen.
Go to the top of the page
 
theDBguy
post Jan 1 2018, 10:29 PM
Post#14


Access Wiki and Forums Moderator
Posts: 72,745
Joined: 19-June 07
From: SunnySandyEggo


Hi Phil,

You're welcome. We're all happy to assist. Like I said though, if you find a technique where it will not require you to modify existing database objects, please consider sharing it for others' benefit.

Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    19th July 2018 - 04:55 AM