Oops! I did a little checking with Google, and found that forms don't have a HasData property - only Reports do.
So, you can use something like this:
Code:
If Me![SubformControlName].Form.Recordset.RecordCount > 0 Then
Me![SubformControlName].Form.allowAdditions = False
Else
Me![SubformControlName].Form.allowAdditions = True
End If
However:
According to the article, that means the forms will not show with no records. I tried the workarounds and all I could get was the "No Records" window to show.
But if the subform's record source is not updatable (e.g. a Calculated query), then setting AllowAdditions = True won't work (i.e. Access won't do it) because record additions ARE updates.
So it appears that if there are no records to display AND the recordsource is not updatable, there is no workaround - that's just the way Access works.
What you could do is create a textbox with a message in it something like "There are no whatever records for this job number". In design view, put the textbox on top of the subform, and set it's visible property to "No". Add something like this to the After Update event of the Job_Number control of the main form:
Code:
If Me![SubformControlName].Form.Recordset.RecordCount > 0 Then
Me![SubformControlName].Visible = True
Me![TextboxName].Visible = False
Else
Me![SubformControlName].Visible = False
Me![TextboxName].Visible = True
End If
so the subforms don't show at all (even blank) if there is no data for them. The textboxes will tell users will know why they don't see them.