Edit displayed data items (1 Viewer)

yamus

Member
Local time
Today, 16:17
Joined
Aug 12, 2020
Messages
81
First of all i want to point that i seek directions
Well, within my small app u have search forms that display search results based on different criteria.
I initially worked with listbox to display results and now i want to add the feature that allows users to edit or delete each record. In other words, i want to have edit button and delete buttons in each row of the listBox.
I made a small search online and i found this suggestion of using datagrid or gridView. But i don't wether it is the coreect choice or not. Can anyone direct me please
 

June7

AWF VIP
Local time
Today, 07:17
Joined
Mar 9, 2014
Messages
5,425
I think datagrid and gridview are associated with other programs such as C#, VB6, VB.net. In Access, use a form in Continuous view. Or a form in Datasheet view and format an unbound textbox to look like a button.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:17
Joined
Oct 29, 2018
Messages
21,359
Hi. Can you post a link to the information you found online? Thanks.
 

yamus

Member
Local time
Today, 16:17
Joined
Aug 12, 2020
Messages
81
Hi. Can you post a link to the information you found online? Thanks.
Hi.
To be clear, when i searched on google under "add edit button to listbox" i got suggestions that contain keywords like "datagrid" and "grid view" and as i mentionned i have no idea how to realise what i asked help about
I want to have edit button and delete bitton within every row
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:17
Joined
Oct 29, 2018
Messages
21,359
Hi.
To be clear, when i searched on google under "add edit button to listbox" i got suggestions that contain keywords like "datagrid" and "grid view" and as i mentionned i have no idea how to realise what i asked help about
I want to have edit button and delete bitton within every row
Okay, since I also don't use DataGrid or GridView, I would just echo what @June7 suggested and also recommend using a continuous form or subform instead of a listbox. Hope that helps...
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:17
Joined
May 21, 2018
Messages
8,463
There is an ActiveX data grid and you may be able to download examples. I am not sure if it is supported in 64 bit or newer versions of Access. It is extremely poorly documented and not easy to work with. The Gridview is a VBA net name. It is super powerful and would be great if such a thing existed in access. However you can do all of this in a subform.
 

Isaac

Lifelong Learner
Local time
Today, 08:17
Joined
Mar 14, 2017
Messages
8,738
i want to add the feature that allows users to edit or delete each record. In other words, i want to have edit button and delete buttons in each row of the listBox.
Do you mean that, once they click one item in the Listbox, your form then filters to show only one record?
If so, why not just create a Delete button on the form?
 

yamus

Member
Local time
Today, 16:17
Joined
Aug 12, 2020
Messages
81
Do you mean that, once they click one item in the Listbox, your form then filters to show only one record?
If so, why not just create a Delete button on the form?
Hi
I already made what you suggested
What i want is edit button and delete button in each row
 

Isaac

Lifelong Learner
Local time
Today, 08:17
Joined
Mar 14, 2017
Messages
8,738
Sorry if I'm confused, what I meant is ... if clicking on the Listbox filters the form to show only 1 record, then why do you need to worry about having the edit/delete button on each row ?
Can you post a screenshot of what the screen looks like after they click an item in the Listbox?
 

yamus

Member
Local time
Today, 16:17
Joined
Aug 12, 2020
Messages
81
Sorry if I'm confused, what I meant is ... if clicking on the Listbox filters the form to show only 1 record, then why do you need to worry about having the edit/delete button on each row ?
Can you post a screenshot of what the screen looks like after they click an item in the Listbox?
Hi
First, my app is in french, so i'm sorry if you don't understand what is written on the GUI
As you can see, i have a search that is based on different criteria (The 4 comboBoxes above)
Results are displayed in the listBox below
When the listBox is clicked, the selected row is highlighted and then there is some backend treatment to identify the selected row in the database
As you suggested. I already made a delete button and edit button(the red button and the purple button respectively) and it is working fine for both delete and edit (First select a row and then either delete it or edit it)
My concern is how to make the two buttons appear on each row. I was inspired by some web designs that illustrate data displayed in table with edit/delete buttons on each row and i wanted to copy the exact same idea in Access
 

Attachments

  • shot.png
    shot.png
    31.5 KB · Views: 146

theDBguy

I’m here to help
Staff member
Local time
Today, 08:17
Joined
Oct 29, 2018
Messages
21,359
Hi
First, my app is in french, so i'm sorry if you don't understand what is written on the GUI
As you can see, i have a search that is based on different criteria (The 4 comboBoxes above)
Results are displayed in the listBox below
When the listBox is clicked, the selected row is highlighted and then there is some backend treatment to identify the selected row in the database
As you suggested. I already made a delete button and edit button(the red button and the purple button respectively) and it is working fine for both delete and edit (First select a row and then either delete it or edit it)
My concern is how to make the two buttons appear on each row. I was inspired by some web designs that illustrate data displayed in table with edit/delete buttons on each row and i wanted to copy the exact same idea in Access
Hi. I will just repeat the suggestion already mentioned at the beginning of this thread. Have you already tried using a continuous subform to replace your listbox yet? Just curious...
 

Isaac

Lifelong Learner
Local time
Today, 08:17
Joined
Mar 14, 2017
Messages
8,738
Hi
First, my app is in french, so i'm sorry if you don't understand what is written on the GUI
As you can see, i have a search that is based on different criteria (The 4 comboBoxes above)
Results are displayed in the listBox below
When the listBox is clicked, the selected row is highlighted and then there is some backend treatment to identify the selected row in the database
As you suggested. I already made a delete button and edit button(the red button and the purple button respectively) and it is working fine for both delete and edit (First select a row and then either delete it or edit it)
My concern is how to make the two buttons appear on each row. I was inspired by some web designs that illustrate data displayed in table with edit/delete buttons on each row and i wanted to copy the exact same idea in Access
Ahh - OK, got it. Thanks for the additional information - it did help me understand.

All I can suggest are alternatives, they aren't Edit or Delete buttons, but they are tied to the user interacting with the Listbox itself.

1) Double-click event - that might Edit the item
2) Right-click event - that might trigger a Delete custom menu.
To code a right click event, use mouse down, and something like:
Code:
Private Sub List0_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = acRightButton Then
        If Me.List0.ItemsSelected.Count = 0 Then
            Exit Sub
        Else
            MsgBox "You pressed the right button."
            'something else?
        End If
    End If
End Sub

Sorry it's not what you wanted - just a possible alternative.
 

yamus

Member
Local time
Today, 16:17
Joined
Aug 12, 2020
Messages
81
Hi. I will just repeat the suggestion already mentioned at the beginning of this thread. Have you already tried using a continuous subform to replace your listbox yet? Just curious...
Hi
sorry for not replying you the first time you made your suggestion
i don't know how to use continous subForms. I had this idea to drag the query and drop it on the form and then switch the page view. I don't know if what i'm doing is correct or not
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:17
Joined
Oct 29, 2018
Messages
21,359
Hi
sorry for not replying you the first time you made your suggestion
i don't know how to use continous subForms. I had this idea to drag the query and drop it on the form and then switch the page view. I don't know if what i'm doing is correct or not
Hi. No worries. We can't assume either what you know and what you don't. That's why we encourage asking questions. If we recommend something that doesn't make sense, you can ask for clarifications. In this case, you could either do that, drag and drop, or create a continuous form based on your query. You simply select your query and then click on the Ribbon to Create > Forms > More Forms > Multiple Items. You can then open it in Design View and add your buttons. You can then drag and drop that new form to your other form (you may have to adjust the size to fit).
 

yamus

Member
Local time
Today, 16:17
Joined
Aug 12, 2020
Messages
81
Ahh - OK, got it. Thanks for the additional information - it did help me understand.

All I can suggest are alternatives, they aren't Edit or Delete buttons, but they are tied to the user interacting with the Listbox itself.

1) Double-click event - that might Edit the item
2) Right-click event - that might trigger a Delete custom menu.
To code a right click event, use mouse down, and something like:
Code:
Private Sub List0_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = acRightButton Then
        If Me.List0.ItemsSelected.Count = 0 Then
            Exit Sub
        Else
            MsgBox "You pressed the right button."
            'something else?
        End If
    End If
End Sub

Sorry it's not what you wanted - just a possible alternative.
I appreciate the help you provided
Thanks anyway
 

yamus

Member
Local time
Today, 16:17
Joined
Aug 12, 2020
Messages
81
Hi. No worries. We can't assume either what you know and what you don't. That's why we encourage asking questions. If we recommend something that doesn't make sense, you can ask for clarifications. In this case, you could either do that, drag and drop, or create a continuous form based on your query. You simply select your query and then click on the Ribbon to Create > Forms > More Forms > Multiple Items. You can then open it in Design View and add your buttons. You can then drag and drop that new form to your other form (you may have to adjust the size to fit).
HI
Thanks for the help. I started to get how to use subforms in my app and i am working on it
Thanks again for the help. I appreciate it
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:17
Joined
Oct 29, 2018
Messages
21,359
HI
Thanks for the help. I started to get how to use subforms in my app and i am working on it
Thanks again for the help. I appreciate it
Hi. You're welcome. Again, we are all here if you get stuck.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:17
Joined
May 21, 2018
Messages
8,463
This example looks like yours only difference it uses a subform. So the data is editable. You can add/edit/and delete records.
(This demo was to show advanced filtering techniques). So just turn your listbox into a subform and you are good to go.
FIlter.jpg
 

Users who are viewing this thread

Top Bottom