Coding a form with a subform.

C

conmecsmith

Hello,

I have a big problem that i've tried to fix. i have a form that has a
subform, and i am trying to code an "If... Then... Elseif..." statement.
Here is an example of the code i am trying to write (figure out)

If Me![ReturnedItems].SourceObject = False Then

'''ReturnedItems is the subform name

Exit Sub
ElseIf Me![ReturnedItems].SourseObject = True Then
If Form![ReturnedItems]!SOQReturned.Value = False Or Me!Qty.Value <> _
Form![ReturnedItems]!SOQReturned.Value Then

'''SOQReturned is a value on my subform --- Qty is a value on my form

Form![ReturnedItems]!MODReturned.Visible = False

'''MODReturned is another value on my subform

ElseIf Me!Qty.Value = Form![ReturnedItems]!SOQReturned.Value Then
Form![ReturnedItems]!MODReturned.Visible = True
End If
End If

What is happening is that the subform runs off a query. Not all of the
entries in my form have an entry in my subform. what i want is when my
subform is visible on my form, i want it to run the code stated above
(starting with the:
Form![ReturnedItems]!SOQReturned.Value). But when the subform isn't shown
(doesn't have an entry), i don't want it to do anything. How can i make this
happen? Can anyone please help me?

Thanks in advance,
Jay
 
Top