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

Selection Does Not Appear In Combobox

P: n/a
I have a continuous form with several unbound comboboxes in the form header. The
comboboxes are used to provide criteria for the SQL of the form. The code behind
the form looks like:

Public Sub FormSQL()
Dim SQLStr As String
SQLStr = < Code to build SQL String based on selection in comboboxes>
SQLStr = SQLStr & ";"
Me.RecordSource = SQLStr
End Sub

Each combobox contains this code:

Private Sub <NameOfCombobox>_AfterUpdate()
Call FormSQL()
End Sub

Everything works fine as long as the the SQL returns one or more records.
However, when a selection is made in any combobox and that selection causes the
SQL to not return any records, the combobox goes blank rather than displaying
the selection. If another selection is then made in the same combobox that also
does not return any records in the SQL, that selection does appear in the
combobox.

Does anyone have any ideas as to why the first selection does not appear in the
combobox?

Thanks!

Steve
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I don't know why it happens, but a possible work around would be to check the number of
records returned by the sql before you tell the form to use it.

--
Wayne Morgan
"Steve" <No****@Spam.Net> wrote in message
news:sP**************@newsread2.news.atl.earthlink .net...
I have a continuous form with several unbound comboboxes in the form header. The
comboboxes are used to provide criteria for the SQL of the form. The code behind
the form looks like:

Public Sub FormSQL()
Dim SQLStr As String
SQLStr = < Code to build SQL String based on selection in comboboxes>
SQLStr = SQLStr & ";"
Me.RecordSource = SQLStr
End Sub

Each combobox contains this code:

Private Sub <NameOfCombobox>_AfterUpdate()
Call FormSQL()
End Sub

Everything works fine as long as the the SQL returns one or more records.
However, when a selection is made in any combobox and that selection causes the
SQL to not return any records, the combobox goes blank rather than displaying
the selection. If another selection is then made in the same combobox that also
does not return any records in the SQL, that selection does appear in the
combobox.

Does anyone have any ideas as to why the first selection does not appear in the
combobox?

Thanks!

Steve

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.