UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Check For Existing Data, Access 2007    
 
   
didacticone
post Mar 22 2018, 06:47 AM
Post#1



Posts: 10
Joined: 16-March 18



Hi everyone,

I have created a database for employees to sign it and out. The functionality has been working great but I am running into an issue of people forgetting if the signed in or not; therefore they will sign in or out twice.

The way it is formatted is every employees name is show on a form with a sign in and sign out button under their name. When they click sign in, it it fills in a field called date1 with the current date, it also fills in a field called signindate with the current date, it also fills in the current time in a field signintime. When they click sign out, it fills in a field called signouttime.

Could someone help me with the code to disable the button for signing in until the following day or popup a msgbox if the current date is already in the database for their name; for example they already signed in. I've tried a few things but am still struggling, thanks for the help!
Go to the top of the page
 
nuclear_nick
post Mar 22 2018, 07:24 AM
Post#2



Posts: 1,820
Joined: 5-February 06
From: Ohio, USA


Actually a few issues to cover here.

First, I would capture date and time for both in and out. What happens if someone works past midnight? (For example, we've got 4 shifts here... first, second, third, weekend.) I think you'll find functions like DateDiff, DateAdd, etc. will work better with an entire date.

Second, could you do it with one button instead? First click would add an 'in'. Second click would read an 'in' without an 'out', so assume 'out', and add an 'out'. That would keep any errors from occurring when someone slips and they click the 'out' when they meant to click the 'in' button.
Go to the top of the page
 
BruceM
post Mar 22 2018, 07:29 AM
Post#3


UtterAccess VIP
Posts: 7,993
Joined: 24-May 10
From: Downeast Maine


What if the employee leaves for a few hours for an appointment, and signs in again later that day?

Assuming each record shows a single sign-in and sign-out, at the record's Current event you could have something like:

Dim blnIn As Boolean

blnOut = (Not IsNull(Me.SignOut) And IsNull(Me.SignIn)) Or Me.NewRecord
Me.cmdSignOut.Enabled = Not blnOut
Me.cmdSignIn.Enabled = blnOut

You may need something similar when you press the SignIn button, so SignIn is disabled and SignOut enabled immediately.

Edit: I would probably do something like Nick suggested, with a single button and a label or caption that changes. That would mean the code that runs would depend on whether the most recent click was to sign in or sign out. I think having two buttons is the simpler approach, though.

It would help to know more about the structure. For instance, is each record for a single sign-in and sign-out?
Go to the top of the page
 
didacticone
post Mar 22 2018, 07:30 AM
Post#4



Posts: 10
Joined: 16-March 18



I hear what you are saying and appreciate the thought. It's like chess trying to think a few steps ahead always. Fortunately we never work overnight shifts, so it is not something I have to worry about. Your second idea I like, but for my staff, I like a separate in and out button. For 30+ plus years a couple of my guys have always signed in on paper, so this is a totally new concept for them. I am trying to emulate the paper modal as best I can to make it easy for them if you understand what I mean. They have responded well, thankfully, so far, but I would like to try what I had in my initial post first if you have any suggestions on that. Thanks again for your thoughts.
Go to the top of the page
 
didacticone
post Mar 22 2018, 07:35 AM
Post#5



Posts: 10
Joined: 16-March 18



Hey Bruce, thanks for the response.

When an employee clicks sign in that adds one record to the table with the sign out time and left blank. Then when they click sign out, the sign out field will fill in on that same record. So one employee should have one record per day.

I am slightly confused as how to implement your code... where on the form would that go?
Go to the top of the page
 
projecttoday
post Mar 22 2018, 07:38 AM
Post#6


UtterAccess VIP
Posts: 11,300
Joined: 10-February 04
From: South Charleston, WV


You would query the table. You could use the Dcount function or the Dlookup function.
Go to the top of the page
 
BruceM
post Mar 22 2018, 07:43 AM
Post#7


UtterAccess VIP
Posts: 7,993
Joined: 24-May 10
From: Downeast Maine


I suggested the form's Current event, with similar code in the Click event of the SignIn button, so that cmdSignIn is disabled and cmdSignOut enabled as soon as a SignIn time is entered. Start with the Current event.

You can use the Current event also to disable both buttons if SignOut is completed (assuming SignOut cannot be completed until there is a SignIn value). Or filter the records to show only those where SignOut is null.

You may want a way to do a manual entry of the time, in case somebody forgets to sign in or out.

Can you describe how each employee accesses their own record? Does each user do a sign-in, or what exactly? To put it another way, do you have a way to prevent a user from marking the wrong record?
Go to the top of the page
 
nuclear_nick
post Mar 22 2018, 07:46 AM
Post#8



Posts: 1,820
Joined: 5-February 06
From: Ohio, USA


QUOTE
For 30+ plus years a couple of my guys have always signed in on paper, so this is a totally new concept for them.


And doing a database like this isn't a new concept for you?

smile.gif

Oh, I know. Some of us old-timers have a hard time with change... I didn't like going from version '2003' to version '2010', and later I'm trying to get excited that we're getting O365 sooner or later.

But once you can show them just how much simpler things are, they may come around. We changed another piece of software about 10 years ago, and it took two years to get a manager to quit using the old terminology and begin using the new. It can be a long process, getting people to embrace new technology.

(And I'm still not totally impressed by 2010, there are times I want my 2003 back. smile.gif )
Go to the top of the page
 
didacticone
post Mar 22 2018, 07:56 AM
Post#9



Posts: 10
Joined: 16-March 18



Nick- creating a database like this from scratch, yes is a totally new concept for me, but one that I am open to and hoping to learn and show my guys that in the long run it's easier. This idea was actually theirs and I think its a good one so I'm trying to figure it out.

Bruce- so to give you an idea, the bones are here and we have been testing while also doing the standard sign in, because I was hoping for feedback and I am getting it which is great. The thing is the guys aren't ready to manually do anything with it, I have built in contingencies for half days and leaving early and things like that. In rare circumstances where there is nothing currently coded, I will manually fix it.

I thought about each person having to enter a unique code before it would let them sign in or out so this way they couldnt mistakenly sign in/out as someone else, but they werent happy with that right now... baby steps though.
Go to the top of the page
 
BruceM
post Mar 22 2018, 08:07 AM
Post#10


UtterAccess VIP
Posts: 7,993
Joined: 24-May 10
From: Downeast Maine


As long as they can go to their own record(s), perhaps by selecting their name from a list, it should be OK for now. If each user has their own computer it could be fairly simple, but from your description it seems that is not the case, so I won't go any further down that road for now.

I will ask again: how does each user access their own record?

Go to the top of the page
 
didacticone
post Mar 22 2018, 08:15 AM
Post#11



Posts: 10
Joined: 16-March 18



It is one computer running the database.

The users do not access their information. This not something I want them to be able to manipulate. I have created forms that are distributed monthly or when requested detailing their time.
Go to the top of the page
 
BruceM
post Mar 22 2018, 08:21 AM
Post#12


UtterAccess VIP
Posts: 7,993
Joined: 24-May 10
From: Downeast Maine


QUOTE
The users do not access their information.

???

I thought this was about introducing users to entering their time into the Access program.
Go to the top of the page
 
didacticone
post Mar 22 2018, 08:28 AM
Post#13



Posts: 10
Joined: 16-March 18



It is about introducing them to sign in and out digitally rather than on paper. Not about managing time through the database. At least not yet. Maybe in the future but again... baby steps. I appreciate all of your guys feedback but I feel like we are drifting away from my original question and getting into procedural practices. Im just trying to learn some coding and once again thank you guys for your input on that.
Go to the top of the page
 
BruceM
post Mar 22 2018, 08:33 AM
Post#14


UtterAccess VIP
Posts: 7,993
Joined: 24-May 10
From: Downeast Maine


I suggested code to enable only the SignIn button for a new record, and to enable only the SignOut button if there is already a SignIn value. Code could be added to disable both command buttons if there is already both a SignIn and SignOut value. If they are to sign in and out digitally there will be time records. You can do with them as you wish.

If this is not suitable, I think a clearer picture of the database is needed.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    13th December 2019 - 11:43 PM