Odd error impacting entire form

hinesbrad

Registered User.
Local time
Today, 01:12
Joined
Jul 15, 2009
Messages
10
Greetings.

I find myself in a bit of an odd situation where I need to keep track of the rate of items being worked on.

I have a tabular form that contains three fields for a time entry:
(HH, MM, and SS) presented so a user can easily enter a time value.:confused:

HH : MM : SS

and another field called pickTime.

I have some visual basic written so that on each occasion when a user enters values into these fields, the database will then perform a calculation on the HH, MM, SS and get a total amount of seconds for a time value. I want to assign and store these values into the database.

My problem is that each record being added appears to change the values in ALL of the lines on the database instead of just one. I'd like to know how I can constrict the code so it only impacts one line instead of all the controls on the form. The code is as follows:

Private Sub txt_PickRate_Enter()
'Begin by assigning variables
Dim HH As Long
Dim MM As Long
Dim SS As Long
Dim timeInSeconds As Long
Dim pickedQty As Long

'Address nulls, figure out pick rate
If IsNull(txt_HH) Then
HH = 0
Else
HH = txt_HH.Value
End If

If IsNull(txt_MM) Then
MM = 0
Else
MM = txt_MM.Value
End If

If IsNull(txt_SS) Then
SS = 0
Else
SS = txt_SS.Value
End If

If IsNull(txt_pickQty) Then
MsgBox ("You Must Enter In a Pick Quantity")
txt_pickQty.Value = 1
End If

'Now compute the amount of time in Pick seconds to assign for pick time.
timeInSeconds = (HH * 3600) + (MM * 60) + (SS)
txt_pickTime.Value = timeInSeconds

'Great. Now take the quantitiy picked, and figure out a case per hour figure.
'Goal is 600


Thanks in advance.

- Brad
A useless yank out of Albuquerque New Mexico addicted to green chile meat pies. Yeah, we're an odd bunch over here.
 

Attachments

  • Form1.jpg
    Form1.jpg
    71.7 KB · Views: 93
It looks to me you are using a continuious subform to collect the data this is what is causing the problem.

David
 
Yes - this is true. So we've identified the problem. What ideas do you have on a workaround?
 
You need to be recording the picking details at main form level and displaying the results at sub form level.
 

Users who are viewing this thread

Back
Top Bottom