Disable listbox item from being used

G

Guest

I have a listbox 'list6' that contains the values two fields 'MemberID' and
'Username' from a table named 'members'. I also have a button called login
which runs code to evaluate the users password and allows them to login and
store the date in another table to track attendance but I am trying to avoid
duplicate entries per memberID. When the user clicks on their name in the
listbox it automatically places the name in the username textbox on the form.
I would like when the user logs in that it will store the username and not
let the user log in again. I am thinking that I could set up an array for
this purpose and have code to evaluate the name in the username textbox
versus the array and return with a msgbox to tell the user that they have
already logged in for the day. If this is correct, I am having some trouble
fiquring out how to set up the array. Or am I way off base on thinking that
an array would be the answer.

Thanks for the help, you guys offer great information and I am sorry I can
not thank you more formally.
 
G

Guest

"...and return with a msgbox to tell the user that they have already
logged in for the day."

I don't understand why you would want to implement such a restriction. What
happens if someone logs in, and then gets a call from their manager to come
to a meeting. Being a digilent employee, they log out of your application and
secure their workstation. 15 minutes later, they return from the quickie
meeting, attempt to log back in to your application, but oops....your code
prevents them from doing so, because they've already logged in today. How is
that increasing productivity?


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

:

I have a listbox 'list6' that contains the values two fields 'MemberID' and
'Username' from a table named 'members'. I also have a button called login
which runs code to evaluate the users password and allows them to login and
store the date in another table to track attendance but I am trying to avoid
duplicate entries per memberID. When the user clicks on their name in the
listbox it automatically places the name in the username textbox on the form.
I would like when the user logs in that it will store the username and not
let the user log in again. I am thinking that I could set up an array for
this purpose and have code to evaluate the name in the username textbox
versus the array and return with a msgbox to tell the user that they have
already logged in for the day. If this is correct, I am having some trouble
fiquring out how to set up the array. Or am I way off base on thinking that
an array would be the answer.

Thanks for the help, you guys offer great information and I am sorry I can
not thank you more formally.
 
R

Ron2005

Besides that an array is temporary so will not work It would be new
everytime the program is started.

To avoid duplicate entries then simply check to see if that user date
combination is already in you table. If it is there then don't add
another record.

Dcount or lookup would work fine.
Create a query that uses the id and date as criteria and then do dcount
on that query and if the count is =0 then add the entry otherwise don't
add the entry. And definitely DON'T lock him out if it is already
there. What if the power goes down or his computer crashes or the app
crashes or the network goes down -- If you lock them out noone can get
back in again.

Ron
 
G

Guest

I know what you are saying but I should have explained what I am aiming for
better. This is to allow students to login at the beginning of class, you
can only log in once and the computer is only available for the 30 minutes
before class. That is why I wanted to you an array because only the school
owner can start and stop the form plus for a two hour class, it is only meant
to track attendance for the student.
 
G

Guest

I know what you are saying but I should have explained what I am aiming for
better. This is to allow students to login at the beginning of class, you
can only log in once and the computer is only available for the 30 minutes
before class. That is why I wanted to use an array because only the school
owner can start and stop the form plus for a two hour class, it is only meant
to track attendance for the student.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top