Solved

Update existing record from Userform

Posted on 2014-12-18
22
84 Views
Last Modified: 2014-12-23
I have an existing table that I want to be able to update the records if needed.
It is in a UseForm
How can I do that?
0
Comment
Question by:bjfulkerson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 9
  • 4
22 Comments
 
LVL 33

Expert Comment

by:Norie
ID: 40507945
Which table do you want to update?
0
 

Author Comment

by:bjfulkerson
ID: 40507955
EmployeeName
0
 
LVL 33

Expert Comment

by:Norie
ID: 40508050
Have you created a separate form for that?

I ask because the form in the workbook you attached previously seemed to be for updating a different table/sheet.

PS Could you upload your current workbook?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:Martin Liss
ID: 40508122
In the UpdateEmployeeEntry userform. There don't see to be input fields for the two with "???".

Private Sub ccmdAdd_Click()
   Dim lastrow As Long
   
   With Sheets("EmployeeName")
     lastrow = .Range("A1048576").End(xlUp).Row
    .Cells(lastrow + 1, "A").Value = TextBox1.Text
    .Cells(lastrow + 1, "B").Value = TextBox8.Text
    .Cells(lastrow + 1, "C").Value = TextBox9.Text
    .Cells(lastrow + 1, "D").Value = TextBox10.Text
    '.Cells(lastrow + 1, "E").Value = ???
    .Cells(lastrow + 1, "G").Value = TextBox3.Text
    '.Cells(lastrow + 1, "H").Value = ???
   End With

End Sub

Open in new window

0
 
LVL 33

Expert Comment

by:Norie
ID: 40508153
Martin

Where did you get the code from?
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40508251
His previous question  that I solved for him.
0
 
LVL 33

Expert Comment

by:Norie
ID: 40508276
Well I'll bow out of this one obviously didn't help the questioner in my previous responses.:)
0
 

Author Comment

by:bjfulkerson
ID: 40508927
Please don't imnorie.
I added to Timesheet and I want to beable to add or update EmployeeName.
STL-Function-Analysis-2015-V2.xlsm
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40509522
Did you try the code I posted above?
0
 

Author Comment

by:bjfulkerson
ID: 40509532
I got this to work.  I needed to add the list index to the combo box.

Now I just want to edit and update and not create an additional record
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40509681
In order to update an employee record, one needs to be selected first, and I believe the best way to do that would be to have the "Show Employee Add or Update" button on the EmployeeName sheet rather than the Home sheet. Is that acceptable?
0
 

Author Comment

by:bjfulkerson
ID: 40509705
I am using the list index to populate the Show employee Add or Update userform.  If the information is already in the useform can I change it and re write the new info back to the table?
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40509721
I am using the list index to populate the Show employee Add or Update userform.
Huh? The only way I see to show that userform is by clicking the "Show Employee Add or Update" button that's on the EmployeeName sheet.
0
 

Author Comment

by:bjfulkerson
ID: 40509742
My version it's on the Home sheet
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40509786
Now I'm totally confused because in a post above you said

I am using the list index to populate the Show employee Add or Update userform.  If the information is already in the useform can I change it and re write the new info back to the table?

but as far as I can see there is no combobox or listbox associated with that userform, so what list index are you talking about?
0
 

Author Comment

by:bjfulkerson
ID: 40509792
This is my current file
STL-Function-Analysis-2015-V2.xlsm
0
 
LVL 47

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40510438
Try this. I hope you like it.
Q-28583690.xlsm
0
 

Author Comment

by:bjfulkerson
ID: 40515099
This is perfect!
0
 

Author Comment

by:bjfulkerson
ID: 40515127
I've requested that this question be closed as follows:

Accepted answer: 0 points for bjfulkerson's comment #a40515099

for the following reason:

Excellent
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40515128
I believe that the Asker meant to give the points to me.
0
 
LVL 47

Expert Comment

by:Martin Liss
ID: 40515158
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0
 

Author Comment

by:bjfulkerson
ID: 40515164
Thanks Martin
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
using vb script 5 49
Delete row if does not start with 0 43 37
Need take combination of numbers out of the list 6 14
Script/Formula to move data to another cell 6 17
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question