D
Dale G
I have a sub form with the controls based on the associated query fields.
ID- Autonumber (Not sure if this field is necessary)
WorkNumber – Text
WorkPath – Text
EmpNo- Number
The sub form is placed on my employee details form,
with the EmpNo set as the record ID and key.
The employees are drivers, and they drive routes that are numbered. They
will drive the same route for three or four months.
Each employee has a work assignment that is printed out from an excel
spreadsheet, (workNumber).
I’m trying to be able to see each employees excel spreadsheet by the push of
a button on the form.
On the sub form, I have the excel file path in Control (txtWorkPath).
I have a command button click event,
Private Sub ViewWorkNumber_Click()
Dim RetVal As Variant
RetVal = Shell("excel.exe """ & Me.[txtWorkPath].Value & """", 1)
End Sub
and the work number is in a textbox to show which assignment the employee
has and which WorkPath will be retrieved when clicking the button.
The sub form is linked by the EmpNo.
This works fine except, for the fact that I will have to redo the file path
when the drivers change routes.
So my question is, can I link this differently so all I need to do is change
the Work Number in the txtWorkNumber.text, and have the file path follow it
to the employee record?
Hope this makes sense.
ID- Autonumber (Not sure if this field is necessary)
WorkNumber – Text
WorkPath – Text
EmpNo- Number
The sub form is placed on my employee details form,
with the EmpNo set as the record ID and key.
The employees are drivers, and they drive routes that are numbered. They
will drive the same route for three or four months.
Each employee has a work assignment that is printed out from an excel
spreadsheet, (workNumber).
I’m trying to be able to see each employees excel spreadsheet by the push of
a button on the form.
On the sub form, I have the excel file path in Control (txtWorkPath).
I have a command button click event,
Private Sub ViewWorkNumber_Click()
Dim RetVal As Variant
RetVal = Shell("excel.exe """ & Me.[txtWorkPath].Value & """", 1)
End Sub
and the work number is in a textbox to show which assignment the employee
has and which WorkPath will be retrieved when clicking the button.
The sub form is linked by the EmpNo.
This works fine except, for the fact that I will have to redo the file path
when the drivers change routes.
So my question is, can I link this differently so all I need to do is change
the Work Number in the txtWorkNumber.text, and have the file path follow it
to the employee record?
Hope this makes sense.