Results 1 to 2 of 2

Thread: how to update a record from combo-box in user form?

  1. #1

    Unhappy how to update a record from combo-box in user form?



    Register for a FREE account, and/
    or Log in to avoid these ads!

    hello guys.
    i really need some help with that thing.
    im newbie in vba but rally like all that stuff.


    i have this table:

    Click image for larger version. 

Name:	1.png 
Views:	23 
Size:	6.6 KB 
ID:	1310

    and i have a form for a user

    Click image for larger version. 

Name:	2.png 
Views:	27 
Size:	26.7 KB 
ID:	1311

    that i want he can update the table like this:
    the user choose a name from the "worker name" combo-box
    and when he click on "update" so the "yes/no" column in the table will show "yes" for the name that was chosen by the user.

    second thing is that
    when the user choose a name and click on the empty button, so it will delete all the record of the name was chosen (all the row).
    this is the code of the form so far

    Code:
    Private Sub cmdAdd_Click()
        Dim lRow As Long
        Dim ws As Worksheet
        Set ws = Worksheets("workers")
        
        'בדיקה אם הוכנסו פרטים
        If Trim(Me.cmbWN.Value) = "" Then
          Me.cmbWN.SetFocus
          MsgBox "הכנס שם עובד"
          Exit Sub
        End If
        
        If Trim(Me.tbDate.Value) = "" Then
          Me.tbDate.SetFocus
          MsgBox "הכנס תאריך בחינה"
          Exit Sub
        End If
        
        ActiveWorkbook.Save
        End Sub
        
        Private Sub tbDate_Change()
        
        End Sub
        
        Private Sub UserForm_Initialize()
        Dim cFullName As Range
        
        Dim ws As Worksheet
        Set ws = Worksheets("workers")
        
        For Each cFullName In ws.Range("שםפרטי")
          With Me.cmbWN
            .AddItem cFullName.Value
            .List(.ListCount - 1, 1) = cFullName.Offset(0, 1).Value
          End With
        Next cFullName
        
        tbDate.Text = Sheets("not done").Range("J3").Text
        End Sub
    thank for all helpers

  2. #2
    Conjurer royUK's Avatar
    Join Date
    Mar 2011
    Location
    Derbyshire, UK
    Posts
    155
    Articles
    0
    Excel Version
    most versions
    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.


    To attach a file to your post, you need to be using the "Reply to Thread', not the "Quick Reply" button.


    On this page, below the message box, you will find a button labelled 'Manage Attachments'.
    Clicking this button will open a new window for uploading attachments.


    You can upload an attachment either from your computer or from another URL by using the appropriate box on this page.
    Alternatively you can click the Attachment Icon to open this page.


    To upload a file from your computer, click the 'Browse' button and locate the file.


    To upload a file from another URL, enter the full URL for the file in the second box on this page.
    Once you have completed one of the boxes, click 'Upload'.


    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    Hope that helps

    Roy

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •