Link to home
Start Free TrialLog in
Avatar of gcgcit
gcgcit

asked on

Syntax for reference control on subform datasheet

On the main form, there is a print button.  Before printing, I need to validate the subform field is not null.

subform is called "sbfrmTransaction"

control is called "cboEmployeeCode"

Here is my code:

If IsNull(???) Then
    MsgBox "Employee code must be filled in before printing."
    Exit Sub
End If

1) What would the syntax be in the IsNull(???)

2) Subform is a datasheet, do I have to loop through all the records to validate each of these fields?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Give this a try:

If IsNull(me.sbfrmTransaction.Form.cboEmployeeCode) Then
< do I have to loop through all the records to validate each of these fields?>

If you are priniting a report, why not just create an Access report whose underlying query excludes nulls in that field (no code necessary)?
Avatar of gcgcit
gcgcit

ASKER

Worked perfectly.