Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
propertyHi!
I am trying to build a search form that extracting records from a list and present them in a list box. I am using the following code: ' Get SelectStatement. Dim Position As Integer Dim SelectStatement As String Position = InStr(1, Me.Result.RowSource, "WHERE") SelectStatement = Me.Result.RowSource 'Build WhereCondition. Dim WhereCondition As String WhereCondition = "True = True" If Not IsNull(Me.txtTitle) Then WhereCondition = WhereCondition & " and Me.Title Like '*" & Me.txtTitle & "*'" End If If Not IsNull(Me.txtAuthorName) Then WhereCondition = WhereCondition & " and Me.AuthorName Like '*" & Me.txtAuthorName & "*'" End If If Not IsNull(Me.txtJournalName) Then WhereCondition = WhereCondition & " and Me.JournalName Like '*" & Me.txtJournalName & "*'" End If If Not IsNull(Me.txtYear) Then WhereCondition = WhereCondition & " and Me.Year Like '*" & Me.txtYear & "*'" End If If Not IsNull(Me.txtKeywords) Then WhereCondition = WhereCondition & " and Me.Keywords Like '*" & Me.txtKeywords & "*'" End If 'Build SQL String. Dim SQL As String SQL = SelectStatement & " WHERE " & WhereCondition & ";" 'Pass SQL to ListBox. Me.Result.RowSource = SQL and I am stucked in the last line which trigger runtime error '380' that the RowSource couldn't be set due to invalid property value. Can anyone suggest why? Thanks in advance Eli |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Search form? | Excel Discussion (Misc queries) | |||
search form in sheet | New Users to Excel | |||
Search Form | Excel Programming | |||
Search form | Excel Programming | |||
use a txt.value on a form to search a sheet | Excel Programming |