I have a main that the user can choose a number from a combo box and the form will then only show records for a task relating to the selected number. The records displayed are shown is the category 'SUBTASK' in the subform 'sfrmAllTasks' and 'frmEIStaff'. Clicking on a command button will preview a report of the currently listed task. It works fine opening a task with filled records, but in tasks without a filled record, I won't want any preview to take place. Part of my code is as follows and is actually all on one line.
Is there a way to use the NZ and DLookup to find if there are any current records available? I'm not sure if I'm on the right track here. Perhaps my syntax is not the only issue?
If Nz(
DLookup(
"[sfrmAllTasks.SUBTASK]",
"tblRoleInfo",
"[sfrmAllTasks.SUBTASK]='" &
[frmEIStaff1.SUBTASK] & "'"), "0") = "0" Then
Result =
MsgBox("There is no record for this
subtask. Total Hours for all Staff Members
is 0.", vbOKOnly, "No Records Exist")
Is there a way to use the NZ and DLookup to find if there are any current records available? I'm not sure if I'm on the right track here. Perhaps my syntax is not the only issue?
If Nz(
DLookup(
"[sfrmAllTasks.SUBTASK]",
"tblRoleInfo",
"[sfrmAllTasks.SUBTASK]='" &
[frmEIStaff1.SUBTASK] & "'"), "0") = "0" Then
Result =
MsgBox("There is no record for this
subtask. Total Hours for all Staff Members
is 0.", vbOKOnly, "No Records Exist")