Coding in Access

jrsarrat

New Member
Joined
Jul 8, 2018
Messages
47
Using Access, I have created a form for employees to log in at the start of their day, log out for lunch, back in from lunch; and lastly, log out at the end of their day. What I want is to create a command that will automatically highlight the next button for them to click, based on their previous login (In, Out for lunch, return from lunch, End of day). Is this possible? Your guidance is much appreciated!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Personally I would not have a bunch of buttons, but a combo with those options. The user selects the correct one and presses one button.
If you are going to select based on the previous selection, then you could select that for them and all they need is press the button.?
If each type of entry has a sequence number that should make it easier.
 
Upvote 0
Personally I would not have a bunch of buttons, but a combo with those options. The user selects the correct one and presses one button.
If you are going to select based on the previous selection, then you could select that for them and all they need is press the button.?
If each type of entry has a sequence number that should make it easier.

That sounds like a better idea! How might I go about this? Are there instructions on how to do this specific request? If not, can you assist me, please?
 
Upvote 0
Ok, I'll try and help, but a novice as well, but off the top of my head.

This is what I would do.
Create a table tblLoginTypes
That table will have fields
Code:
LogTypeID       Autonumber
LogSequence   Number
LogDescription Text 20 (or as many characters as needed/expected)

Use the Form wizard to create a form for the table.
Put the entries in in the sequence they happen.

Then on your form, add the combo using the wizard, LogTypeID as the bound field, Log Description as the 2nd field. 2 fields in the combo, width, 0;2.5
That should then show the description in the combo.
Save the LogTypeID field to your table, along with the UserID and Date.

Now when the person logs in look for the maximum Sequence number for the user and date, and add 1 to it, to set the combo.
Use NZ function for when there is none, at the start of the day.
I would also make a key of UserID,Date,Sequence as a unique key, to stop a duplicate being added, but start off small and work out the kinks.

That should get you started.

HTH
 
Last edited:
Upvote 0
Ok, I'll try and help, but a novice as well, but off the top of my head.

This is what I would do.
Create a table tblLoginTypes
That table will have fields
Code:
LogTypeID       Autonumber
LogSequence   Number
LogDescription Text 20 (or as many characters as needed/expected)

Use the Form wizard to create a form for the table.
Put the entries in in the sequence they happen.

Then on your form, add the combo using the wizard, LogTypeID as the bound field, Log Description as the 2nd field. 2 fields in the combo, width, 0;2.5
That should then show the description in the combo.
Save the LogTypeID field to your table, along with the UserID and Date.

Now when the person logs in look for the maximum Sequence number for the user and date, and add 1 to it, to set the combo.
Use NZ function for when there is none, at the start of the day.
I would also make a key of UserID,Date,Sequence as a unique key, to stop a duplicate being added, but start off small and work out the kinks.

That should get you started.

HTH

Thanks! How do I bound this code to a table/field? Must it be included in the code?
 
Upvote 0
Keep in mind that if you attempt to highly regulate which selection can be made based on prior selections, you will eventually have to deal with nonconforming situations. Assuming this is not a time management db, what if they log in after lunch and forget to log back out and go home? How are they supposed to log back in again when they would be restricted to logging out? While that may not be a possible scenario, the point is worth making, I think.

I tried the link. All I get is a blank white page.
 
Upvote 0
Home page is accessible so it's probably a browser issue. Maybe Flash, or a recent version 61 update that I applied but I suspect it's a video problem.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top