D
Don
I have a query "qryAdjustedTime" that is the basis to another Sum query
called "qryDailyDrivenHours". One of the criteria in the first query is how
many people are in a department. This field is not part of a table it is a
field I created just for these calculations. "Staff" is user defined data and
is entered to form the basis for calculations for all other records in the
query. Example in query Staff: [Enter Number of Staff]. The calculations in
the first query are then Summed in the second query into time (seconds).
In a form I have a drop down combo box that is a table of the possible
departments and in the department record is the number of people in the
department. What I would like to do is select the department say "Optical"
and attached to the record is number of people in the department "10". The
name of the field for the 10 people is called "Staff".
Now here is the tricky part! If possible, I want to link the data of the
combo box, in the form, to the first query's field "Staff". So when I choose
"Optical" in the combo box, Access will feed the "10" to the "Staff" field to
make the calculations accurate.
I have the following code in a button called Calculation. Here is what I
have (of course it does not work).
Private Sub btnToCalculatePositions_Click()
On Error GoTo Err_btnToCalculatePositions_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Professor Weedenfoofer"
stLinkCriteria = "[qryAdjustedTime].[Staff]=" & "'" & Me![txtStaff] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnToCalculatePositions_Click:
Exit Sub
Err_btnToCalculatePositions_Click:
MsgBox Err.Description
Resume Exit_btnToCalculatePositions_Click
What do you think?
called "qryDailyDrivenHours". One of the criteria in the first query is how
many people are in a department. This field is not part of a table it is a
field I created just for these calculations. "Staff" is user defined data and
is entered to form the basis for calculations for all other records in the
query. Example in query Staff: [Enter Number of Staff]. The calculations in
the first query are then Summed in the second query into time (seconds).
In a form I have a drop down combo box that is a table of the possible
departments and in the department record is the number of people in the
department. What I would like to do is select the department say "Optical"
and attached to the record is number of people in the department "10". The
name of the field for the 10 people is called "Staff".
Now here is the tricky part! If possible, I want to link the data of the
combo box, in the form, to the first query's field "Staff". So when I choose
"Optical" in the combo box, Access will feed the "10" to the "Staff" field to
make the calculations accurate.
I have the following code in a button called Calculation. Here is what I
have (of course it does not work).
Private Sub btnToCalculatePositions_Click()
On Error GoTo Err_btnToCalculatePositions_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Professor Weedenfoofer"
stLinkCriteria = "[qryAdjustedTime].[Staff]=" & "'" & Me![txtStaff] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnToCalculatePositions_Click:
Exit Sub
Err_btnToCalculatePositions_Click:
MsgBox Err.Description
Resume Exit_btnToCalculatePositions_Click
What do you think?