Dynamic Table records

kamran60

Registered User.
Local time
Yesterday, 23:06
Joined
Nov 23, 2012
Messages
14
Hello,

I have a web access database, and every time a user logins to use that database, the database should make a record of who used it in one of its pre-existing tables.

Any suggestions as to how would I be able to make dynamic login records everytime a user logs in?

Thanks
 
I made some progress with it. I created a new macro for the table where I used CreateRecord to SetField in the fields of the table. Then, I appended this macro within my AutoExec macro. This works, and creates new records and set field values. However, my field values are User, Email, Date. Right now I am using only dummy field values like 'asdf' for User and Email, and that works fine. But when I try to set field value to currentwebuser(type) where type=0,1,2,3...my setfield does not work. Can anyone explain why?
 
Hi,

This works, and creates new records and set field values. However, my field values are User, Email, Date.

I assume you meant field names correct? Not field values?
If so, I would not name a field Date as that is a reserved word in Access. It's better to use a field name like LoginDate.

But when I try to set field value to currentwebuser(type) where type=0,1,2,3...my setfield does not work. Can anyone explain why?

Have you published this web database to a SharePoint Server running Access Services yet? If not, the CurrentWebUser() expression will return null.

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
SDET II - Access Test Team - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out (coming soon)
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.mspx
----------
 
Yes-you are right. I changed Date to LoginDate.

In addition, my database is published to a Sharepoint site where users can login to change the database. I want to know how can I set up a table that records which user logged in to access the database.

I dont have access to the database; but here is a pseudo-code for my data macro:

CreateRecord in LoginLog

SetField
Name= User.LoginLog
Value= CurrentWebUser(1)

SetField
Name= EmailAddress.LoginLog
Value= CurrentWebUser(3)

SetField
Name= LoginDate.LoginLog
Value= Date()

I saved this macro as LoginLog.CreateRecord and placed it inside my AutoExec macro so that my LoginLog table records a new entry every time the database is opened. Unfortunately, I cannot set the field values as CurrentWebUser(). Any ideas how can I progress?
 
Last edited:
Hi,

CurrentWebUser() is a UI level expression/function and cannot be used in data macros. This is because of the separation from the data layer and UI layer. See my reply to your other post in this forum for more details on that.

If someone built a tool that dynamically updated values in your table from completely outside Access what would CurrentWebUser() actually represent?

In order to use CurrentWebUser() in a data macro, you would need to grab it from a UI macro (or VBA code) as a value and then push it down to the data layer through a parameter in a named data macro.

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
SDET II - Access Test Team - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out (coming soon)
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.mspx
----------
 

Users who are viewing this thread

Back
Top Bottom