View Full Version : Set combo rowsource on form open event


arage
05-09-2002, 07:41 AM
Set combo rowsource on form open event
Unless I’m mistaken you can set a combo box’s rowsource on the openEvent of a form correct? In my combo’s property sheet I specified a type of “Table/query” as well as the number of columns and which one is bound.

And then I placed the below code into my forms onOpen event, but my combo is coming up blank.
I checked in debug mode and the strSql statement is filling properly.
Please advise.

'cboCode must be set once the form opens
Dim strSQL As String
Select Case glblDirCode
Case 1100
'none...5/9/02
Case 1400
strSQL = "SELECT Code,Description FROM Budget WHERE Code = '" & 140160250 & "' Or Code = '" & 140360249 & "'"
End Select

'set cboCode's recordsource...5/9/02
Me.Code.RowSource = strSQL

RichMorrison
05-09-2002, 10:29 AM
Try "Me.Repaint" after you set the combobox RecordSource.

RichM

arage
05-09-2002, 10:33 AM
I just solved part of the problem as I was running an old function before the new SELECT CASE statements I entered. Now I’m working on whittling down that list even more.