Alternative to List Box and Query (1 Viewer)

MatthewB

Member
Local time
Today, 04:57
Joined
Mar 30, 2022
Messages
85
I am developing a contractor contacts database. These contractors are a table of people who fit a ServiceCategoru, like a plumber, or a landscaper. Its all housing based. Recently I learned about List Box and how to display fields in a query. I also learned how to select from the list and display the record in a form. But the record in the form cannot be edited in the form (methinks). What is an alternative approach to achieving this result? Ultimately I want to included ways to navigate the ServiceCategory with a 'search' function.

Thanks
 

June7

AWF VIP
Local time
Today, 03:57
Joined
Mar 9, 2014
Messages
5,425
Why cannot record be edited in form?
 

MatthewB

Member
Local time
Today, 04:57
Joined
Mar 30, 2022
Messages
85
Why cannot record be edited in form?
I am not sure at this stage of my learning. The list box displays a query result. I use an OnClick script such as txt_Contractors.ServiceCategory = lst_ContQuery.column(1) to set the form record field. I data does not appear to be live to change.
 

Eugene-LS

Registered User.
Local time
Today, 14:57
Joined
Dec 7, 2018
Messages
481
I will look at this method.
It's very easy!
Code:
Private Sub YourListBoxName_AfterUpdate()
Dim sFilter As String
    
    If Me.YourListBoxName.ListIndex > -1 Then 'Value Selected
        sFilter = "[ServiceCategory] = " & Me.YourListBoxName
    End If

    If Len(sFilter) > 0 Then
        Me.Filter = sFilter
        Me.FilterOn = True
    Else
        Me.Filter = ""
        Me.FilterOn = False
    End If
End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:57
Joined
May 7, 2009
Messages
19,175
you can use this "filter" on continuous form.
 

Attachments

  • Services.accdb
    704 KB · Views: 214

Users who are viewing this thread

Top Bottom