| re: Selection Does Not Appear In Combobox
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" <NoSpam@Spam.Net> wrote in message
news:sPEeb.986$3S.732@newsread2.news.atl.earthlink .net...[color=blue]
> 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
>
>[/color] |