title: How to display the data or table in database in mysql as editable in ms access form? (Like List box as editable )
body: <p>Am Using Ms-Access as front end and mysql as backend.
  i displayed data from mysql i list box, i need to edit the data in the listbox itself.</p>
  
  <p>Is there any other way that i can edit the data.</p>
  
  <p>I tried several ways i can't find.</p>
  
  <p>Thank in advance.</p>
  
  <p>Need your help.</p>
  
  <p>Form in list attached the image that i displayed in list view</p>
  
  <p><a href="https://i.stack.imgur.com/wo0Kv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wo0Kv.png" alt="enter image description here"></a></p>
  
  <pre><code>    Option Compare Database
      Option Explicit
      Dim cn As New ADODB.Connection
      Dim rs As New ADODB.Recordset
      Dim cmdtext As New ADODB.Command
  
  Private Sub cmd_extract_Click()
  Dim strfield As String
  Dim strextract As String
  Dim intItemsInList As Integer
  Dim intCounter As Integer
  Dim intRow As Integer
  Dim intCol As Integer
  intItemsInList = Me![lstbox].ListCount
  For intCounter = 0 To intItemsInList - 1
    Me![lstbox].RemoveItem 0
  Next
  
  strfield = Me.cmb1
  If strfield = "ALL" Then
  strextract = "SELECT *FROM emp_details JOIN dept_details ON emp_details.E_Dept = dept_details.D_Name ORDER BY Emp_Id  ASC;"
  Set cmdtext.ActiveConnection = cn
  cmdtext.CommandType = adCmdText
  cmdtext.CommandText = strextract
  Set rs = cmdtext.Execute
  Me.lstbox.AddItem ("EMP-ID" &amp; ";" &amp; "EMP-NAME" &amp; ";" &amp; "EMP-DEPT" &amp; ";" &amp; "EMP-SALARY" &amp; ";" &amp; "DEPT_ID" &amp; ";" &amp; "DEPT_NAME" &amp; ";" &amp; "DEPT_HEAD")
  If (rs.RecordCount &lt;&gt; 0) Then
  Do While Not rs.EOF
  With Me.lstbox
  .AddItem (rs.Fields(0) &amp; ";" &amp; rs.Fields(1) &amp; ";" &amp; rs.Fields(2) &amp; ";" &amp; rs.Fields(3) &amp; ";" &amp; rs.Fields(4) &amp; ";" &amp; rs.Fields(5) &amp; ";" &amp; rs.Fields(6))
  .ColumnHeads = True
  rs.MoveNext
  End With
  Loop
  End If
  Else
  strextract = "SELECT * FROM emp_details JOIN dept_details ON emp_details.E_Dept = dept_details.D_Name WHERE dept_details.D_Name = '" &amp; strfield &amp; "';"
  Set cmdtext.ActiveConnection = cn
  cmdtext.CommandType = adCmdText
  cmdtext.CommandText = strextract
  Set rs = cmdtext.Execute
  'Me.lstbox.RowSourceType = "Value List"
  Me.lstbox.AddItem ("EMP-ID" &amp; ";" &amp; "EMP-NAME" &amp; ";" &amp; "EMP-DEPT" &amp; ";" &amp; "EMP-SALARY" &amp; ";" &amp; "DEPT_ID" &amp; ";" &amp; "DEPT_NAME" &amp; ";" &amp; "DEPT_HEAD")
  If (rs.RecordCount &lt;&gt; 0) Then
  Do While Not rs.EOF
  With Me.lstbox
  .AddItem (rs.Fields(0) &amp; ";" &amp; rs.Fields(1) &amp; ";" &amp; rs.Fields(2) &amp; ";" &amp; rs.Fields(3) &amp; ";" &amp; rs.Fields(4) &amp; ";" &amp; rs.Fields(5) &amp; ";" &amp; rs.Fields(6))
  .ColumnHeads = True
  rs.MoveNext
  End With
  Loop
  End If
  End If
  End Sub
  
  Public Sub Form_Load()
  Dim cnnstring As String
  cnnstring = "Driver={MySQL ODBC 8.0 UNICODE Driver};Server=localhost;Database=My_Project2;Uid=root;Pwd=password;"
  If cn.State = 0 Then
  cn.Open cnnstring
  End If
  Dim cquery As String
  cquery = "SELECT * FROM dept_details;"
  'FULL OUTER JOIN dept_details ON emp_details.E-Dept = dept_details.D_NAME
  
  With rs
  Set .ActiveConnection = cn
  .Source = cquery
  .LockType = adLockOptimistic
  .CursorType = adOpenKeyset
  .Open
  End With
  rs.MoveFirst
  
  With Me.cmb1
  .AddItem "ALL"
  Do
  cmb1.AddItem rs!D_Name
  rs.MoveNext
  Loop Until rs.EOF
  End With
  rs.Close
  End Sub
  
  
  Private Sub Form_Open(Cancel As Integer)
  Dim cnnstring As String
  cnnstring = "Driver={MySQL ODBC 8.0 UNICODE Driver};Server=localhost;Database=My_Project2;Uid=root;Pwd=password;"
  cn.Open cnnstring
  Dim cquery As String
  cquery = "SELECT * FROM dept_details;"
  'FULL OUTER JOIN dept_details ON emp_details.E-Dept = dept_details.D_NAME
  
  With rs
  Set .ActiveConnection = cn
  .Source = cquery
  .LockType = adLockOptimistic
  .CursorType = adOpenKeyset
  .Open
  End With
  rs.MoveFirst
  
  With Me.cmb1
  .AddItem "ALL"
  Do
  cmb1.AddItem rs!D_Name
  rs.MoveNext
  Loop Until rs.EOF
  End With
  rs.Close
  End Sub
  
  
  Private Sub lstbox_DblClick(Cancel As Integer)
  'If cn.State = 1 Then
  'cn.Close
  'End If
  
  Dim listid As Long
  listid = Me.lstbox.Value
  DoCmd.Close acForm, "Form_Form3"
  DoCmd.OpenForm "Form4", OpenArgs:=listid
  End Sub
  </code></pre>