displaying name and last visit on form

jeffrey159

Registered User.
Local time
Today, 11:41
Joined
Jan 17, 2013
Messages
24
how do i display the current user’s full name, date and time of last visit.
in a form?? like

Example: i have 2 forms "Login" "LoginMenu"

After logging in via Login
it should Display the current user’s full name, date and time of last visit. in LoginMenu

Question 2:
how do i do this coding If a button is not available for the current user then the next buttons must cover its space automatically.

if i have 3 buttons, the middle one is not visible for current user, how do the next button cover its space??

what's the code to do this
 
Last edited:
Tell us about the table where you store the login info.
 
Tell us about the table where you store the login info.
i915.photobucket.com/albums/ac355/jeffrey159/Untitled_zpsb29821aa.jpg

i still can't post links yet. here it is.
 
Ok you've showed the table fields and some values.

How do you capture the info at login time? What exactly are the steps?
What is your logic to display the data?

We have no idea what the form or buttons are, so any info or a jpg would help.

We're sort of flying blind here, so any info will be helpful.
 
Ok you've showed the table fields and some values.

How do you capture the info at login time? What exactly are the steps?
What is your logic to display the data?

We have no idea what the form or buttons are, so any info or a jpg would help.

We're sort of flying blind here, so any info will be helpful.


so sorry about that, not sure what to show. here\'s the file

log in admin pass admin. codes are in there >.<

i need help on this question:
If a button is not available for the current user then the next buttons must cover its space automatically.
 

Attachments

I take it from your database that the Created and Updated fields and values in tblUsers are related to the assignment and update of the user record.

I think you need another table (eg tblUserHistory)
in which you would record the userId,LoginDateTime. This table could be joined with tblUsers to get the data you need.

In the Validation process, if login is successful, you would either insert a new record in the tblUserHistory if you want to record all logins; or update the user's record if you only wish to record the one record for each user.

You could take the existing user record in tblUserHistory and record the info to a variable, and use that variable in your user info display; then modify the user record in tblUserHistory with the Now function (which gives Date and Time).

You have to record the Login Date/Time if you want it persist it across sessions.

Hope this is helpful.
 
I take it from your database that the Created and Updated fields and values in tblUsers are related to the assignment and update of the user record.

I think you need another table (eg tblUserHistory)
in which you would record the userId,LoginDateTime. This table could be joined with tblUsers to get the data you need.

In the Validation process, if login is successful, you would either insert a new record in the tblUserHistory if you want to record all logins; or update the user's record if you only wish to record the one record for each user.

You could take the existing user record in tblUserHistory and record the info to a variable, and use that variable in your user info display; then modify the user record in tblUserHistory with the Now function (which gives Date and Time).

You have to record the Login Date/Time if you want it persist it across sessions.

Hope this is helpful.

Thanks!
but for question 2, how do i do that??

If a button is not available for the current user then the next buttons must cover its space automatically.
 
Have you tried simply making the button .visible = False?
That should make it invisible, I'm not sure how it affects the position - you could try it and work from that.

If you look at the Form and button properties, you will probably find some sort of coordinates for each button. You might be able to play with those values when you make a button invisible.

You might try googling "programatically setting a button's position with vba".
 
Have you tried simply making the button .visible = False?
That should make it invisible, I'm not sure how it affects the position - you could try it and work from that.

If you look at the Form and button properties, you will probably find some sort of coordinates for each button. You might be able to play with those values when you make a button invisible.

You might try googling "programatically setting a button's position with vba".

because i don't know what to google for that's why i can't find the solution :(
 
I answered another post where someone was moving a button via vba.
Please read the post and see the database in post#22 at
http://www.access-programmers.co.uk/forums/showthread.php?t=230366&page=2

I think you can see some of the techniques to move a button. So once you know which user you're dealing with, and therefore which buttons to display, when the form opens (the open event) - you put the buttons where you want them. You may have to experiment to get the positions right, but once you get the position of the Top and Left, you can change the values to what you need and refresh/repaint the form.

The database and form I adjusted just shows it can be done, and can be done by a button click. So the key for you now is to identify the coordinates of the buttons involved, and create some code to adjust them under certain conditions.
Code:
If user = XXXX Then
  keep buttons in original position
else
  move button code and refresh/repaint
  goes in here
end if

Another thought: You could build 2 forms.

One with all buttons; one with the reduced number of buttons
Code:
If user = XXX Then
 open form 1
else
 open form2
end if
Good luck.
 
Last edited:
I answered another post where someone was moving a button via vba.
Please read the post and see the database in post#22 at
http://www.access-programmers.co.uk/forums/showthread.php?t=230366&page=2

I think you can see some of the techniques to move a button. So once you know which user you're dealing with, and therefore which buttons to display, when the form opens (the open event) - you put the buttons where you want them. You may have to experiment to get the positions right, but once you get the position of the Top and Left, you can change the values to what you need and refresh/repaint the form.

The database and form I adjusted just shows it can be done, and can be done by a button click. So the key for you now is to identify the coordinates of the buttons involved, and create some code to adjust them under certain conditions.
Code:
If user = XXXX Then
  keep buttons in original position
else
  move button code and refresh/repaint
  goes in here
end if
Another thought: You could build 2 forms.

One with all buttons; one with the reduced number of buttons
Code:
If user = XXX Then
 open form 1
else
 open form2
end if
Good luck.

Thanks a lot for the sample. manage to get it work :D
 

Users who are viewing this thread

Back
Top Bottom