Examining records in a subform

N

ndalton

I have one subform with a few records, each with a combo box that the user
selects a value from. I want to prevent the user from performing a certain
action (via clicking a button) if any of the combo box values for the records
in the subform are null. Is there any way to check these values from my main
form's command button's code?

Thanks, all.

-ndalton
 
A

Allen Browne

If the subform's table has a relationship to the main form's table, you
could use this kind of logic:

Dim varResult As Variant
Dim strWhere As String
strWhere = "([MyForeignKey] = " & Nz(Me.[MyMainID], 0) & _
") AND ([MyComboField] Is Null)"
varResult = DLookup("ID", "MySubformTable", strWhere)
If Not IsNull(varResult) Then
MsgBox "Not allowed"
End If
 
E

eos

AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George
 
E

eos

AUTO-REPLY From George Levitt

Please allow this to confirm a system receipt of your e-mail.

I am out of the office until Wednesday morning (1/12/05) and will not be
reviewing or responding to email or voicemail until that time.

I look forward to replying to your message on Wednesday.

Thanks and warmest regards, George
 
Top