View Full Version : Conditionally run macro


Grimmers
03-13-2009, 04:00 AM
I have a subform sf_members on a main form f_membership.
I am trying to conditionally run a macro based on a check box in one of the records in the subform.
If one or more of the checks is ticked I want to run the macro else throw a message box.
I have tried various VBA syntaxes but none seem to do the trick.

Thanks in advance,


David

gemma-the-husky
03-13-2009, 04:09 AM
if subdetails!chkfield then
runmacro
end if

Grimmers
03-13-2009, 04:40 AM
Gemma,

This just gives me "object required"



If sf_members!ysnJnrSel = 0 Then
MsgBox "The condition is true!"
End If
If sf_members!ysnJnrSel <> 0 Then
MsgBox "The condition is false!"
End If



The subform is in datasheet mode and may have multiple records. Do I need to count the records that are ticked or something? Sorry to be a pain but it's really bugging me at the moment. (Nearly midnight in OZ!!)

cheers,

David