SourceObject problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
After much trying I have manage to set the following code:

Private Sub ORDER_TYPE_LostFocus()
If [ORDER TYPE] = "SPARES/SERVICE" Then
Forms![ORDERS FORM]![ORDER DETAILS].SourceObject = "ORDER DETAILS
EXTENDED QUERY subform"
End If
End Sub

It was suppose to change the SourceObjet of the subform "Order Details" from
"ORDERS FORM" to a specific subform if Order Type "Spares/Service" is
selected.

I have managed that, but it changes it for all records and it stays like
that. How can I do it to work only for individual records?

Thank you in advance for your help,

rosana
 
I am working on a project right now where I had the same issue. I have 6
subforms. I position these subforms one right over the top of each other.
Each subform is marked as invisible in its' properties. As something occurs
on my primary form, such as the click of a button, I change the properties of
the specific subform that I want visible. When finished I change its'
properties to invisible and move on to the next subform.
 
Rosana said:
After much trying I have manage to set the following code:

Private Sub ORDER_TYPE_LostFocus()
If [ORDER TYPE] = "SPARES/SERVICE" Then
Forms![ORDERS FORM]![ORDER DETAILS].SourceObject = "ORDER DETAILS
EXTENDED QUERY subform"
End If
End Sub

It was suppose to change the SourceObjet of the subform "Order Details" from
"ORDERS FORM" to a specific subform if Order Type "Spares/Service" is
selected.

I have managed that, but it changes it for all records and it stays like
that. How can I do it to work only for individual records?


You have to set the SourceObject for the other records too.

Add an Else to you If statement that sets it the other way.

Most likely, you also want to run the same code in the
form's Current event so the subform matches up with each
record as you scroll through the data.
 
Back
Top