doble click to modify selected record in listbox and right click to delete

BLUEPOMME

New Member
thank you for share the link

the code for me it did nothing , what i would like is to doble click on record and userform1 opens with the information in the each control to make any changes to it and save it again to table
 

DanteAmor

Well-known Member
thank you for share the link

the code for me it did nothing , what i would like is to doble click on record and userform1 opens with the information in the each control to make any changes to it and save it again to table

I help you with the double click. To modify the data. But I need to know all the information detail.
- Is the data to be modified in the listbox?
- Or do you have to get them from the sheet?
- How did you load the data in the listbox?
- What data goes in which control?
- After modifying where to put the update, on the sheet or in the listbox or both?


To delete a record, I recommend you select a record from the listbox and press a button.


If you want me to help you with all the above, the most practical thing is that you upload your file to the cloud and explain to me with a simple example how your userform works.

You could upload a copy of your file to a free site such www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
 

BLUEPOMME

New Member
Hello Dante,

and thank you to looking in to this , i hope you can open the file it is saved on google drive

so the listbox fills from table tblEvents on sheet1 , eventos.

doble click on a record should open userfrom1 (created to add new records to table) with the information in the controls

for now i managed that the userform 1 opens with the selected record on doble click like this :

Code:
Private Sub LB_00_DblClick(ByVal Cancel As MSForms.ReturnBoolean)  With Me.LB_00
    For i = 0 To .ListCount - 1
      If .Selected(i) Then
      
        UserForm1.TextBox2.Value = .List(i, 5)
        UserForm1.ComboBox2.Value = .List(i, 4)
        UserForm1.TextBox4.Value = .List(i, 6)
        UserForm1.ComboBox3.Value = .List(i, 7)
        UserForm1.ComboBox5.Value = .List(i, 9)
        UserForm1.TextBox5.Value = .List(i, 10)
      
        
        UserForm1.Show
       
       
        
      End If
    Next
  End With
now i still missing to add the first column the one with the date in .List(i, 0) that needs to go to the calendar in frame1 , and the time that is in column hora .List(i, 8) that goes to combobox1 (issues with time format too).

from there you can make any modification to the record and after it , it would save it as updated record back to the table tblEvents

on other side i agree with you too, for creating a buttom on userform4 to delete selected record .

i hope you can acces file and understand my bad english writing
 

DanteAmor

Well-known Member
I'm confused.
You started the thread with the form4 now you mention the form1.
I gladly help you with everything, but we go in parts.
What do you want to start?
 

BLUEPOMME

New Member
ok sorry for this let me try to explain

i use userfrom1 to add new records to table.

i use userfrom4 to show all records on table, also i like to add a button that delete selected record from list and table.

also i would like to do doble click on record on the listbox to modify any information/data and save it back to table for that i belived to use userfrom1 too just to update record .
to fill userform1 i started the vba code like i posted in previous post ,(but of course if you recomend to do use other userform instead)

at the end i would like sheet1 (EVENTOS) hidden so i can only use the userfrom to manage table (tblEvents) like an data entry form (search,add,modify,delete data) but i don´t like the Built in Data Entry Form that comes with excel
 

DanteAmor

Well-known Member
Ok let's start with this.
i use userfrom4 to show all records on table, also i like to add a button that delete selected record from list and table.
Is it necessary that the data in the "events" sheet be in a table? It is more complicated to work with a table.
Is it necessary to load more than 10 columns in the listbox?
Of all the columns there is some unique data to use as a key and thus be able to erase. If a key does not exist, then it will be necessary to create a temporary sheet.
 

BLUEPOMME

New Member
the table in sheet events is nessesary as it is used for a other sheet called calendario (deleted in uploaded file) .

it is NOT nessesary to load columns b,c and d to listbox
 

Some videos you may like

This Week's Hot Topics

Top