473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Making a fitness class booking after logging in as a user

I have a booking page set up which shows the username field as well as Class type and Date

The issue I am having is that when I log in as a user, how do I automatically get the username field updated to that user which has logged in. So that the booking comes under their details. Can you guys share any coding to connect my login to automatically populate the username field. Or if there is an alternative way of making a booking whilst logged in, that would be great too.

This is my module

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Public CurrentUserID As String
  4.  
  5. Public Function setUser(user123)
  6.     CurrentUserID = user123
  7. End Function
  8.  
  9. Public Function deleteUser()
  10.     CurrentUserID = ""
  11. End Function
My login Code

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3. Private Sub btnLogin_Click()
  4.  
  5. MemberID = Nz(DLookup("[MemberID]", "tblMember", "[Username] ='" & Me.txtUsername.Value & "' And password ='" & Me.txtPassword.Value & "'"), 0)
  6. If MemberID = 0 Then
  7.     MsgBox "Incorrect Username or Password"
  8.   Else
  9.     MsgBox "You have successfully logged in"
  10.     Call setUser(Me.txtUsername.Value)
  11.     DoCmd.OpenForm "frmHomepage"
  12.     End If
  13. End Sub
My homepage

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Public Sub btnBookings_Click()
  3.  
  4.     DoCmd.OpenForm "frmBookings"
  5.  
  6. End Sub
  7.  
  8. Private Sub btnLogout_Click()
  9.  
  10. Response = MsgBox("Are you sure you want to logout?", vbYesNo + vbQuestion, "Warning")
  11.    If Response = vbYes Then
  12.  
  13.         Call deleteUser
  14.         DoCmd.Close
  15.         DoCmd.OpenForm "frmStart"
  16.     Exit Sub
  17.    End If
  18.  
  19. End Sub
  20.  
  21. Public Sub btnMembershipdetails_Click()
  22.  
  23.     MsgBox (CurrentUserID)
  24.     'Copy Below to whereever you want member specific details
  25.     DoCmd.OpenForm "frmMemberDetails", , , "Username = '" & CurrentUserID & "'"
  26.  
  27. End Sub
When I login as a user, I can load up their specific details through the module. I'm assuming it will require me doing something similar to get each user to make a booking when they login.
Mar 5 '18 #1
2 1412
twinnyfo
3,653 Expert Mod 2GB
2k7mmurtaza,

Welcome to Bytes!

First, when posting code, please use the Code Tags button "[CODE/]" to have it properly formatted on this forum.

Second, I think a potential solution may be found in this Article:
How To Create User Permissions and Customized Menus in MS Access. If you have additional questions concerning that set-up, please let me know, I might be able to shep some light on it.

There are less-elaborate ways to do this, but the foundation is the same. Find out who the system user is and update your information based upon that user's information.

Hope that hepps!
Mar 5 '18 #2
twinnyfo
3,653 Expert Mod 2GB
Did the linked article provide any additional insight for you?
Mar 6 '18 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Francis Dhaenens | last post by:
I am building an ASP application, in this application, one of the functions is that I have to know exactly how long a user has used a certain page of the application. so I need a way to long the...
0
by: Simon Elliott | last post by:
I have a class which uses a singleton to output progress messages for logging or display. It's typically used deep within a hierarchy of aggregations, inheritances and containers. The singleton...
2
by: Simon Elliott | last post by:
I have a class (actually the same one described in part 1) which implements a state machine. The state machine is inside a pimpl, and looks a bit like this: class foo::fooImpl { public:...
4
by: titancipher | last post by:
I have a container that I wish to allow the user to specify a custom comparison method very similar to std::less. However, I want it to function more like memcmp (returning -1 0 1), and I want to...
3
by: Mikip | last post by:
Hi, I have some properties that are common to all pages so I have created a base class which every page inherits from. I now also want to use these properties within User Controls on the page....
8
by: Johs | last post by:
I see a lot of different conventions on the net when it comes to making a class. Currently I make a class in a single .cc file like: #include <string> #include <iostream> using namespace std; ...
1
by: manish1 | last post by:
I Want To Develop A Software In Asp Which Handles Following Things: 1. User Name 2. Login And Logout Time In A Particular Website 3. Number Of Downloads From A Particular Website 4. How Much Mb...
3
by: Thomas Pajor | last post by:
Hey everybody, I got into serious trouble with template programming. I have a class which uses three template arguments, say template<typename Atype, typename Btype, typename Ctype> class...
1
by: pushrodengine via AccessMonster.com | last post by:
Is there a way to log user actions? What I would like is to be able to log user activities within the database. The table “tblUserEvents” would contain two fields. Field one “EventTime”...
4
by: Steven Simpson | last post by:
Stefan Ram wrote (in "More than one language in a page"): Is this a new trend of user-agent writers (Microformats, and now Google) staking claims on the @class namespace? I'm surely not the only...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.