T
tbrogdon
I have tried to answer this question on a different forum and also
have searched for several days through the groups for an answer...I am
stymied as to why this seems to be such a difficult issue for me to
describe and why it is not as simple to remedy as it may immediately
seem. Maybe my problem is in my initial design - I really don't know.
Anyway, here goes...
I have tblProduction and tblProductionOperation that are linked on
field ProductionID (pk in tblProduction). Also, tblProduction has
fields Date, Shift, and Dept. Unique combinations of those three
fields should be associated with a unique value in ProductionID - so
much so that it would make a lot more sense to input Date, Shift, and
Dept first and have Access check for duplicates before auto-generating
the autonumber for ProductionID because on the first day this db is
used "live" I should have the following entries in tblProductionand it
is possible currently to input conflicting data given my settings/
design:
ProductionID: 1
Date: 1/1/2008
Department: Hard Tool
Shift: 1
(end of main form fields that are entered in tblProduction - see
detailed description below)
ProductionID: 2
Date: 1/1/2008
Department: SoftTool
Shift: 1
ProductionID: 3
Date: 1/1/2008
Department: Hard Tool
Shift: 2
ProductionID: 4
Date: 1/1/2008
Department: Soft Tool
Shift: 2
ProductionID: 5
Date: 1/1/2008
Department: Hard Tool
Shift: 3
ProductionID: 6
Date: 1/1/2008
Department: Soft Tool
Shift: 3
That is what I want BUT I have created a Main form which is bound to
tblProduction (frmProduction - which has the four fields described
above in my example) and a form that is bound to
tblProductionOperation (frmProductionOperation) where data such as
PartNumber, QtyRun, OperatorName, etc. are entered.
frmProductionOperation is a continuous form embedded in frmProduction.
So again what I have is:
Main Form (frmProduction)
txtfield: txtProductionID (visible in form ONLY for troubleshooting
purposes) shows the value "autonumber."
txtfield: txtProductionDate (default = Date() )
cbo: cboDepartment
cbo: cboShift
--------------
Continuous form embedded in Main form (frmProductionOperation linked
to frmProduction by ProductionID)
cbo: Workstation
cbo: PartNumber
cbo: Operator
txtfield: QtyRun
When I open frmProduction the first time txtProductionID shows the
value "autonumber."
txtProductionDate value shows today's date. I hit <enter> and the
focus leaves txtProductionDate WITHOUT changing the value of
txtProductionID from "autonumber."
On the first keystroke entered in cboDepartment, the value of
txtProductionID increments to 1.
THEN I enter the remainder of the text for cboDepartment or select it
from the combo box. I hit <enter> again enter the shift number or
select it from the combo box.
NOTICE when the ProductionID was generated and REMEMBER that all
combinations of Date, Dept, and Shift MUST be unique and no
combination can share a ProductionID. And here is my problem...
With the example just described above it is possible for the user to
enter all of that data, go into the subform and enter data which is
immediately associated with the generated ProductionID, and then
WITHOUT leaving the form CHANGE either Shift or Dept in the Main form
and return to the subform WITHOUT an error and continue entering data
and now I have mixed data all associated with ONE auto-generated
ProductionID.
How can I insure that any unique combination of Date, Dept., and Shift
will ONLY be associated with one ProductionID? How can I have Access
check the values of Date, Dept, and Shift for duplicates in
tblProduction REGARDLESS of ProductionID even though it is the PK and
if Access does find a duplicate combination of those 3 fields it
instructs the user to review the data entered and make any necessary
changes BEFORE allowing the user to enter any data in the subform -
because it is currently possible to have duplicate values for Date,
Shift, and Dept associated with two different PKs and it is also
possible for the user to change the value of Dept or Shift after
entering detail data in the subform and the ProductionID doesn't
change and no error occurs.
Several people have attempted to give me sage advice on this and I
deeply apologize if I haven't been able to communicate the issue
properly. If I am overlooking something fundamental please help me to
see it. I am not imagining this problem and it is beginning to really
be a source of frustration.
Thank you very much in advance,
Tim
have searched for several days through the groups for an answer...I am
stymied as to why this seems to be such a difficult issue for me to
describe and why it is not as simple to remedy as it may immediately
seem. Maybe my problem is in my initial design - I really don't know.
Anyway, here goes...
I have tblProduction and tblProductionOperation that are linked on
field ProductionID (pk in tblProduction). Also, tblProduction has
fields Date, Shift, and Dept. Unique combinations of those three
fields should be associated with a unique value in ProductionID - so
much so that it would make a lot more sense to input Date, Shift, and
Dept first and have Access check for duplicates before auto-generating
the autonumber for ProductionID because on the first day this db is
used "live" I should have the following entries in tblProductionand it
is possible currently to input conflicting data given my settings/
design:
ProductionID: 1
Date: 1/1/2008
Department: Hard Tool
Shift: 1
(end of main form fields that are entered in tblProduction - see
detailed description below)
ProductionID: 2
Date: 1/1/2008
Department: SoftTool
Shift: 1
ProductionID: 3
Date: 1/1/2008
Department: Hard Tool
Shift: 2
ProductionID: 4
Date: 1/1/2008
Department: Soft Tool
Shift: 2
ProductionID: 5
Date: 1/1/2008
Department: Hard Tool
Shift: 3
ProductionID: 6
Date: 1/1/2008
Department: Soft Tool
Shift: 3
That is what I want BUT I have created a Main form which is bound to
tblProduction (frmProduction - which has the four fields described
above in my example) and a form that is bound to
tblProductionOperation (frmProductionOperation) where data such as
PartNumber, QtyRun, OperatorName, etc. are entered.
frmProductionOperation is a continuous form embedded in frmProduction.
So again what I have is:
Main Form (frmProduction)
txtfield: txtProductionID (visible in form ONLY for troubleshooting
purposes) shows the value "autonumber."
txtfield: txtProductionDate (default = Date() )
cbo: cboDepartment
cbo: cboShift
--------------
Continuous form embedded in Main form (frmProductionOperation linked
to frmProduction by ProductionID)
cbo: Workstation
cbo: PartNumber
cbo: Operator
txtfield: QtyRun
When I open frmProduction the first time txtProductionID shows the
value "autonumber."
txtProductionDate value shows today's date. I hit <enter> and the
focus leaves txtProductionDate WITHOUT changing the value of
txtProductionID from "autonumber."
On the first keystroke entered in cboDepartment, the value of
txtProductionID increments to 1.
THEN I enter the remainder of the text for cboDepartment or select it
from the combo box. I hit <enter> again enter the shift number or
select it from the combo box.
NOTICE when the ProductionID was generated and REMEMBER that all
combinations of Date, Dept, and Shift MUST be unique and no
combination can share a ProductionID. And here is my problem...
With the example just described above it is possible for the user to
enter all of that data, go into the subform and enter data which is
immediately associated with the generated ProductionID, and then
WITHOUT leaving the form CHANGE either Shift or Dept in the Main form
and return to the subform WITHOUT an error and continue entering data
and now I have mixed data all associated with ONE auto-generated
ProductionID.
How can I insure that any unique combination of Date, Dept., and Shift
will ONLY be associated with one ProductionID? How can I have Access
check the values of Date, Dept, and Shift for duplicates in
tblProduction REGARDLESS of ProductionID even though it is the PK and
if Access does find a duplicate combination of those 3 fields it
instructs the user to review the data entered and make any necessary
changes BEFORE allowing the user to enter any data in the subform -
because it is currently possible to have duplicate values for Date,
Shift, and Dept associated with two different PKs and it is also
possible for the user to change the value of Dept or Shift after
entering detail data in the subform and the ProductionID doesn't
change and no error occurs.
Several people have attempted to give me sage advice on this and I
deeply apologize if I haven't been able to communicate the issue
properly. If I am overlooking something fundamental please help me to
see it. I am not imagining this problem and it is beginning to really
be a source of frustration.
Thank you very much in advance,
Tim