By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,652 Members | 1,911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,652 IT Pros & Developers. It's quick & easy.

Combo box headache

Expert 100+
P: 218
Hi!
I have inherited a continuous form whose detail area contains two combo boxes.
The rowsource of the 2nd combo depends on the selection made in the 1st, and is rebuilt in the GotFocus event of the 2nd combo.
This all works OK, BUT.....
When I click into the 2nd combo, the contents of the 2nd combo of all existing rows on screen disappear, until I click somewhere else on the form, at which point, all "missing" data reappears.

Users will definitely not appreciate this behaviour! but I am constrained as to where I can move the code to set the correct rowsource for the 2nd combo.

I must be missing something!

Any ideas gratefully received

TIA
Steve
Jun 6 '07 #1
Share this Question
Share on Google+
2 Replies


ADezii
Expert 5K+
P: 8,607
Hi!
I have inherited a continuous form whose detail area contains two combo boxes.
The rowsource of the 2nd combo depends on the selection made in the 1st, and is rebuilt in the GotFocus event of the 2nd combo.
This all works OK, BUT.....
When I click into the 2nd combo, the contents of the 2nd combo of all existing rows on screen disappear, until I click somewhere else on the form, at which point, all "missing" data reappears.

Users will definitely not appreciate this behaviour! but I am constrained as to where I can move the code to set the correct rowsource for the 2nd combo.

I must be missing something!

Any ideas gratefully received

TIA
Steve
Please post the relevant code.
Jun 6 '07 #2

Expert 100+
P: 218
Code, as requested

Expand|Select|Wrap|Line Numbers
  1. Private Sub PickAdult_GotFocus()
  2. If IsNull(Me.PickChild) Then
  3. InSql = ""
  4. Else
  5. InSql = "SELECT AdultNo, PAddressName, TagNo, PupOrigNum, AdultPriority FROM AppParent "
  6. InSql = InSql & " WHERE pupOrigNum = " & Me.PickChild & " and TagNo = " & Me.Parent.TagNo & " order by AdultPriority"
  7. End If
  8. Me.PickAdult.RowSource = InSql
  9. Me.PickAdult.Requery
  10. End Sub
This code works as advertised, but temporarily clears existing data in other records. I think the problem is to do with where the code is fired from

TIA
Steve
Jun 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.