requery

teiben

Registered User.
Local time
Today, 00:22
Joined
Jun 20, 2002
Messages
462
I have 3 combo boxes cboCustomer2, cbospec2 and cbotest . When cbocustomer is selected it queries the cbospec which in turn queries the cbotest. Problem is if a user selects cboCustomer2, cbospec2 & cbotest then they change the cboCustomer2. The cbospec clears but the cbotest doesn't.

Help:

these are afterupdate:

If IsNull(Me.cboCustomer2) Then
' clear the bottom combo's current value
Me.cboSpec2 = Null
Me.cboTest = Null
' lock and disable the bottom combo
Me.cboSpec2.Enabled = False
Me.cboSpec2.Locked = True

Me.cboTest.Enabled = False
Me.cboTest.Locked = True
Else
' unlock and enable the bottom combo
Me.cboSpec2.Enabled = True
Me.cboTest.Enabled = True

' requery bottom combo based on the selection
' in the top combo
Me.cboCustomer2.Requery
Me.cboSpec2.Requery
Me.cboTest.Requery

End If
End Sub

If IsNull(Me.cboTest) Then

' clear the bottom combo's current value
Me.cboTest = Null
' lock and disable the bottom combo
Me.cboTest.Enabled = False
Me.cboTest.Locked = True
Else
' unlock and enable the bottom combo
Me.cboTest.Enabled = True
Me.cboTest.Locked = False
' requery bottom combo based on the selection
' in the top combo
Me.cboTest.Requery

End If
End Sub :cool:
 
Try clearing out the other combo boxes before doing anything.

Add this in front of the IF statement.

' clear the bottom combo's current value
Me.cboSpec2 = Null
Me.cboTest = Null

If IsNull(Me.cboCustomer2) Then
' lock and disable the bottom combo
Me.cboSpec2.Enabled = False
Me.cboSpec2.Locked = True

Me.cboTest.Enabled = False
Me.cboTest.Locked = True
Else
' unlock and enable the bottom combo
Me.cboSpec2.Enabled = True
Me.cboTest.Enabled = True

' requery bottom combo based on the selection
' in the top combo
Me.cboCustomer2.Requery
Me.cboSpec2.Requery
Me.cboTest.Requery

End If
End Sub
 
THANK YOU!
IT WORKED. not when I moved both lines

Me.cboSpec2 = Null
Me.cboTest = Null

but ......

Me.cboSpec2 = Null


worked. I'm still confused but it worked :p
 

Users who are viewing this thread

Back
Top Bottom