Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form lookup field refers to Focus

Status
Not open for further replies.

molly

Technical User
Jul 17, 2000
219
US
I am getting an error about Focus in my lookup combo box:

"You can’t reference a property or method for a control unless the control has the focus."

Look 9 lines below where i remark, "'next row is yellowed in the debug". The vba is from an earlier tek-tips request which worked fine in a dummy model but boms out in my real model. I don't understand selStart.

Molly


Code:
Private Sub cboDescriptionFilter_AfterUpdate()
    'Unique product ID column numbering from zero.
    If Not IsNull(Me.cboDescriptionFilter.Column(2)) Then
        Me.Recordset.FindFirst "FormulaID=" & Me.cboDescriptionFilter.Column(2)
    End If
End Sub



Private Sub cboDescriptionFilter_Change()

'next row is yellowed in the debug
If Me.cboDescriptionFilter.SelStart > 0 Then
    strText = Mid(Me.cboDescriptionFilter.Text, 1, Me.cboDescriptionFilter.SelStart)
Else
    strText = Me.cboDescriptionFilter.Text
End If

strSQL = "SELECT q.[Description], q.[ProductFamilyID], q.[ProductID], " _
& "q.[PackTypeID], q.[PriceTypeID], q.[ProductType], q.[Inactive Product] " _
& "FROM QryProduct AS q"

strOrder = "ORDER BY [Description], [ProductFamilyID], [ProductID];"

'This will select all if cboDescriptionFilter is empty
strFilter = "WHERE [Description] Like '*" & strText & "*'"

'Change Row Source
Me.cboDescriptionFilter.RowSource = strSQL & " " & strFilter & " " & strOrder
Me.cboDescriptionFilter.Dropdown

End Sub
 
Please refer to my post called:

"Form lookup button for partial description"


It is a continuing post.
Molly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top