I have a sub to determine if overtime has come into play yet on a certain job. If (preapproved) overtime has started then the next (subform) record can automatically be populated from a query checking the overtime allowance. Here is the code.
The issue is that Job Numbers are in a format of:
Example: "12345-1" or "12345-2" or "65487-1"...ok you get it.
you may have noticed the DLookup(CStr("JobNo"),"qryOTAllowanc e")
The actual field in the query is JobNo: Cstr(Jobnumber)
I even tried
In hoping that the "JobNumber.Defa ultValue" would remain a string ("12345-2") instead of a math problem (12345-2 = 12343) because all that i can get to display is "12343" I noticed that if i dont use defaultvalue, i get the actual string, but obviously on the wrong record (the current record, instead of the next record)
Does anybody have any ideas of how to accomplish this? Its driving me nuts. As always..... Thanks for any help.
Code:
Private Sub OT_Test()
If Forms!frmJobHourCostEmpName.TotalHours = 8 Then
Me.OTJob.DefaultValue = True
Me.BilledHours.DefaultValue = DLookup("OTApproval", "qryOTAllowance")
Me.JobNumber.DefaultValue = DLookup(CStr("JobNo"), "qryOTAllowance")
Me.BilledPercentage.DefaultValue = BilledHours / (8 + Nz(Forms!frmJobHourCostEmpName.OTHours, 0))
End If
End Sub
Example: "12345-1" or "12345-2" or "65487-1"...ok you get it.
you may have noticed the DLookup(CStr("JobNo"),"qryOTAllowanc e")
The actual field in the query is JobNo: Cstr(Jobnumber)
I even tried
Code:
Dim JobNumberTemp as string
JobNumberTemp = DLookup(CStr("JobNo"), "qryOTAllowance")
Me.JobNumber.DefaultValue = JobNumberTemp
Does anybody have any ideas of how to accomplish this? Its driving me nuts. As always..... Thanks for any help.
Comment