Getting User Information for Access Web Database

This past week I began exploring some of the capabilities in the new Access Web Database template. This template allows you to create a no-code database and upload it to a SharePoint 2010 server — thus allowing business users to quickly create and host small databases for business related tasks.

My first task was to create a data macro that would add a new user to the database when the published web database is visited the first time. Additionally, each return I would like to capture the number of times the user visited and when they visited the site last.

In order to capture this information I created a table named Users that included the columns UserLogin, UserWebID, UserDisplayName, UserEmailAddress, FirstVisitDate, LastVisitDate, TotalVisits. I created a data macro that would handle the add/update procedure (more in a later blog post) and then set my default form to update the user when the form is loaded.

I needed a way to get the information about the user — and Access did not disappoint. Making use of the CurrentWebUser method, I can obtain information about the user; however, the method requires a parameter — this is an enumeration that took some time to locate, so here is a link to the documentation on MSDN.

Name Value Description
acWebUserEmail 3 The current user’s e-mail address.
acWebUserID 0 The current user’s member ID.
acWebUserLoginName 2 The current user’s login name.
acWebUserName 1 The current user’s display name.

Knowing the enumeration helps when I need to use this information to create a new user in my database — and I can use the user’s email address with another data macro to send them a welcome email when they first visit the site!


5 thoughts on “Getting User Information for Access Web Database

  1. Hi,

    I am tasked with displaying a form that shows current users that are viewing the Web Access Database page and have no clue on how to go about it. Could you advise or show some pointers to this?


  2. HI,
    I worked on access 2010 web data macros.When i uploaded to sahrepoint 2010 it’s is very slow.I want to know weather this backdrop and overcome in sharepoint server pack 1 or not.Please send to my mail about this.

    1. Usually, the first execution of a data macro will take a little longer. I have not tested under Service Pack 1 yet, but I would imagine this experience remains unchanged since the first execution is uncompiled code.

      1. Chris,

        You were suppose to write a blog on how to Add/Update procedure on adding user information. I created a table with fields I want to capture and created a named macro with parameters as well as created a macro on load in the main page to run the data macro but it’s not fetching user information. Let me know if you have the solution and share it with me.

      2. Rishi,

        After this post, I did not do any further work with Access Services and I apologize there was no follow-up. My current projects have had little need of Access Services so I do not know when I will be able to return to this topic. However, if you have a solution, feel free to post a follow-up comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s