Calculated form fields inconsistently display when triggered by the Events Property (1 Viewer)

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
I have a timecard input form, where i enter a time code, a punch in time, and a punch out time. There is another form field named TimeDuration which calculates the difference between these times and multiplies x 24.


Then, based on the code entered, the corresponding time category field will populate on the form (and also in the database). The form is driven by a query, not a table.


What I can't figure out is: when I enter some codes (e.g. "W" or "M") - the corresponding field immediately populates, whichout moving to the next record.


However, if i enter "H", "S", "V", or "B", the form field isn't populated, until i move to the next record. I have to go back 1 record to see that the value is entered.


Maybe I'm using the wrong event to drive this, as I'm using a "lost focus" event on the field "Punch_Out"


Here is the VBA which runs after the Punch_Out field loses focus: Any help would be greatly appreciated!

Here is the VBA that runs when data has been entered in the "Punch Out" field.

The current event is "After Update", but I get the same results when I use the same VBA triggered by Before Update, as well as Lost Focus.

I'm also attaching a screenshot of the form:

Thank you in advance for any assistance you can provide! I'm feeling dumbfounded.
 

Attachments

  • enterpunchtime.JPG
    enterpunchtime.JPG
    701.6 KB · Views: 105

theDBguy

I’m here to help
Staff member
Local time
Today, 12:48
Joined
Oct 29, 2018
Messages
21,358
Hi. I don't see any code in your post. Also, it might be simpler if you could just post a copy of the db, so we can step through it.
 

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
Hi. I don't see any code in your post. Also, it might be simpler if you could just post a copy of the db, so we can step through it.

Thanks DB Guy. Here's the file. I'm not the best Access db designer. I feel like there may be a better way to design this using subforms.
My thought process was to capture the timecards, then using calculated fields on the form, summarize the data for the time and post into a time record that includes punched time and also summary of time by timecode by day. The form footer would summarize the batch of data (which would only be a weeks worth of time) and then when the user reviewed the total time for the week, summarized by timecode, they would click the button and Access would write a summary record of time for the week into TimeSummary table. I can explain further, if you need me to.
Thank you SO much for reviewing this. I'm open to any suggestions you can offer, but I'm an intermediate Access user.

Also, my plan was to have a Backend database (R-TA_be.accdb) and a separate accdb file for front end. Both are included in the zip file.
 

Attachments

  • TimeCards App.zip
    410 KB · Views: 113

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:48
Joined
May 7, 2009
Messages
19,169
you set the form as DataEntry=Yes, so you can't see previous record.
I make the empid, date and combo65 Unbound.
see the changes in your form and in it's code.
 

Attachments

  • TimeCards App.zip
    485.7 KB · Views: 104

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
you set the form as DataEntry=Yes, so you can't see previous record.
I make the empid, date and combo65 Unbound.
see the changes in your form and in it's code.

thank you very much Arnelgp. I have noticed the "Data Entry" property over the years and thought that meant to Allow Data Entry. I always thought it was ambiguous as a property because there were also Add, Edit, Delete properties, which to me were what allowed"data entry". Now I know that it has to do with no allowing someone to review previous records.

I'm still testing the changes you made (thank you !).

However, my original question is still a problem:

Can you help me figure this out? I'm happy to pay you a small fee for your assistance. I'm working on this program for my sister who has a small business.

What I can't figure out is: when I enter some codes (e.g. "W" or "M") - the corresponding field immediately populates, whichout moving to the next record.


However, if i enter "H", "S", "V", or "B", the form field isn't populated, until i move to the next record. I have to go back 1 record to see that the value is entered.


Maybe I'm using the wrong event to drive this, as I'm using a "lost focus" event on the field "Punch_Out"


Here is the VBA which runs after the Punch_Out field loses focus: Any help would be greatly appreciated!

Here is the VBA that runs when data has been entered in the "Punch Out" field.

The current event is "After Update", but I get the same results when I use the same VBA triggered by Before Update, as well as Lost Focus.
 

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
Thanks DB Guy. Here's the file. I'm not the best Access db designer. I feel like there may be a better way to design this using subforms.
My thought process was to capture the timecards, then using calculated fields on the form, summarize the data for the time and post into a time record that includes punched time and also summary of time by timecode by day. The form footer would summarize the batch of data (which would only be a weeks worth of time) and then when the user reviewed the total time for the week, summarized by timecode, they would click the button and Access would write a summary record of time for the week into TimeSummary table. I can explain further, if you need me to.
Thank you SO much for reviewing this. I'm open to any suggestions you can offer, but I'm an intermediate Access user.

Also, my plan was to have a Backend database (R-TA_be.accdb) and a separate accdb file for front end. Both are included in the zip file.
Hi. I don't see any code in your post. Also, it might be simpler if you could just post a copy of the db, so we can step through it.
Hi. I don't see any code in your post. Also, it might be simpler if you could just post a copy of the db, so we can step through it.
Hi DBguy - did you get a chance to look at my form? I'm really stumped on this one.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:48
Joined
Oct 29, 2018
Messages
21,358
Hi DBguy - did you get a chance to look at my form? I'm really stumped on this one.
Hi Dilbert. No, I didn't look at your file, because I thought Arnel already fixed it for you. What else is missing?
 

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
Hi DBGuy,.
Arnel did help, but didn't address the core question.

What I can't figure out is: when I enter some codes (e.g. "W" or "M") - the corresponding field immediately populates, whichout moving to the next record.


However, if i enter "H", "S", "V", or "B", the form field isn't populated, until i move to the next record. I have to go back 1 record to see that the value is entered.


Maybe I'm using the wrong event to drive this, as I'm using a "lost focus" event on the field "Punch_Out"


Here is the VBA which runs after the Punch_Out field loses focus: Any help would be greatly appreciated!

Here is the VBA that runs when data has been entered in the "Punch Out" field.

The current event is "After Update", but I get the same results when I use the same VBA triggered by Before Update, as well as Lost Focus.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:48
Joined
Oct 29, 2018
Messages
21,358
Hi DBGuy,.
Arnel did help, but didn't address the core question.

What I can't figure out is: when I enter some codes (e.g. "W" or "M") - the corresponding field immediately populates, whichout moving to the next record.


However, if i enter "H", "S", "V", or "B", the form field isn't populated, until i move to the next record. I have to go back 1 record to see that the value is entered.


Maybe I'm using the wrong event to drive this, as I'm using a "lost focus" event on the field "Punch_Out"


Here is the VBA which runs after the Punch_Out field loses focus: Any help would be greatly appreciated!

Here is the VBA that runs when data has been entered in the "Punch Out" field.

The current event is "After Update", but I get the same results when I use the same VBA triggered by Before Update, as well as Lost Focus.
Hi. When you say "Here is the VBA.." in your post, I expect to see some code, but I still don't. Anyway, to investigate the issue you're having, should I check out your original file or the one Arnel posted?
 
Last edited:

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
Hi. When you say "Here is the VBA.." in your post, I expect to some code, but I still don't. Anyway, to investigate the issue you're having, should I check out your original file or the one Arnel posted?

Either one. The one Armel posted would probably be better to use
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:48
Joined
Oct 29, 2018
Messages
21,358
Either one. The one Armel posted would probably be better to use
Okay, I'll try that when I get back in front of a computer. But before I left the office, I looked at your file and couldn't tell which fields are supposed to auto update after selecting an item from the dropdown. Can you elaborate on that? Thanks.
Sent from phone...
 

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
Hi,
The calculated bound fields for time summary Reg vac sick fields in the detailed form section they are triggered by data entered in the Punchout field
 

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
Okay, I'll try that when I get back in front of a computer. But before I left the office, I looked at your file and couldn't tell which fields are supposed to auto update after selecting an item from the dropdown. Can you elaborate on that? Thanks.
Sent from phone...
I thought it might help if i included an attachment showing the fields on the screen that I'm having a problem with. The calculated fields in the detailed portion of the form (they feed data fields on the underlying table), are triggered by someone entering a PunchOut date value. What is odd, is that the Reg Hours calculated field displays, while the user is on the record, but many of the other calculated fields don't display until you go to the next record. Then, you have to go to the previous record to see what the value was for Vac hours or Holiday Hrs, etc. I'd like for the user to see all the calculated field values before they move on to enter a new record. I'm thinking the footer totals will display totals once the calculated fields in the detail record are populated.
 

Attachments

  • Capture.JPG
    Capture.JPG
    137.4 KB · Views: 111

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
you set the form as DataEntry=Yes, so you can't see previous record.
I make the empid, date and combo65 Unbound.
see the changes in your form and in it's code.
Thank you Arnel. Could you figure out the reason the calculated fields are inconsistently displaying?

The calculated fields in the detailed portion of the form (they feed data fields on the underlying table), are triggered by someone entering a PunchOut date value. What is odd, is that the Reg Hours calculated field displays, while the user is on the record, but many of the other calculated fields don't display until you go to the next record. Then, you have to go to the previous record to see what the value was for Vac hours or Holiday Hrs, etc. I'd like for the user to see all the calculated field values before they move on to enter a new record. I'm thinking the footer totals will display totals once the calculated fields in the detail record are populated.
 

Attachments

  • E2B4EFD8-5AE2-4986-8824-AEC081D37C4D.jpeg
    E2B4EFD8-5AE2-4986-8824-AEC081D37C4D.jpeg
    9.5 KB · Views: 98

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:48
Joined
May 7, 2009
Messages
19,169
check if this solved the problem
note I only zip the Front end, relink it again.
 

Attachments

  • TimeCards App.zip
    85.9 KB · Views: 110

Dilbert99

New member
Local time
Today, 15:48
Joined
Jan 9, 2020
Messages
27
check if this solved the problem
note I only zip the Front end, relink it again.
Hi Arnel
I was designing the form to work as follows: It would be a form that allows for a batch of timecards for an employee to be added.
The batch would be timecards for a single employee for a single pay period. TimeCards would be entered for every day that the employee worked during the pay period. For example, let's say a pay period represents 7 days in a week, starting with Sundays. If i worked 5 days, there would be 5 time records, for example, 9am to 5pm.

As the timecards are entered, the employee would see the total accumulation of, in this example, Regular hours time at the bottom of the screen - in the "Pay Period Total Hours" section. I see that the original issue I had, whereby the totals aren't updated at the bottom section of the form, until i move to the next record. Is there any way to have the totals show while i'm on the same record, after I've entered the punch time?

Also, I think you must have added a function to search for a record with a date, when I enter the date field. This form shouldn't be used for search, only for data additions, deletions, or corrections. When the user moves to the end of the records, they can enter a new record, or they can click on the standard "New Record" button by the standard record navigation section of the access form. If they want to search for a record, they can use the standard Access filter menus to find it.
 

Users who are viewing this thread

Top Bottom