Hi everyone,
Depending on the attached workbook,
How can I edit the employee's Name and badge number thru a userform?
What should we depend on to save the employee's name before changing it, in order to use it as a find key?
Thank you,
Hi everyone,
Depending on the attached workbook,
How can I edit the employee's Name and badge number thru a userform?
What should we depend on to save the employee's name before changing it, in order to use it as a find key?
Thank you,
Last edited by LoveCandle; 07-06-2009 at 07:49 AM.
Take a look at the DataBaseForm example here
http://www.excel-it.com/vba_examples.htm
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
Hi,
Thank you royUK for your useful link you posted,
I applied amendment code in the mentioned link database form example, but it didn't work with me.
No errors appear, but the updates are inserted in the first row of the range only,, I don't know why!!!![]()
Please Login or Register to view this content.
Can you please find me a solution for that,,
That code isn't from the example. What doesn't work?
The code is derived from the example, the only difference is that I removed some lines, which I don't need in my code.
But, the problem now is that when I edit for example record No. 4 of my range .. the changes are inserted in record number 1 not 4 and so on.
I hope that you can find the reason behind that and solve the problem.
Thanks,
You've set the code to work on the activecell, no one selected by the userform - that's how the code in the example works
Hi,
Until now I coundn't understand how the code in example works exactly,,
What does (r) in the following part refer to?
It will be better for me if you correct my code's mistakes and post it?![]()
Please Login or Register to view this content.
Thank you,
Hi,
Can you please help me in this query, I really need the answer ASAP,
Thanks,
Reading the original question, I'm not sure what you mean. Why do you want to save the name before editing it?
Hi,
I believe that we have to save the original name in order for excel to use it as a find key for recognizing the concerned record that should be found and paste the new changes on it.
I hope that my idea is clear now,
Even in the Database example, when I tried to run the Amendment code Directly (Without running find code before it), the same problem appeared (the changes are inserted in record number 1 only) ..
Therefore, I think that there is a relationship between The example find code and amendment code .. but I don't know what is it exactly??!!!
Anyhow, if my belief is incorrect, I would be so thankful for you if you help me writing the suitable code for edit database records without pasting someone's data on another one's.
Moreover, it will nice from you if you can apply that on my previous attached workbook,
Thank you,
Last edited by LoveCandle; 07-04-2009 at 07:58 AM.
The code in your first post does that - select a name from the combobox, edit the name or amend the textbox. Click Edit & the changes are recorded.
Yes, the workbook in my first post does record the changes perfectly if we change the TexBox1 value only ,,
But once we change ComboBox1 value, the code returns an error, because the code looks for ComboBox1 value and doesn't find it in the database because it has been changed and the new value is not available in the database.
So, I think the solution is that we have to save ComboBox1 original value somewhere else, in order to use it for database search.
I hope that you got my idea now,
Thanks,
Amend the Edit Button
![]()
Please Login or Register to view this content.
Sorry royUK, there is no difference between your code's result and mine,
The problem is still existing .. the changes are still recorded in the first record.
Anyhow, I found a solution but it is not that much practical.
My trick solution is saving combobox value in a label (the label will be hidden), and the use the label value as a database search key,
See my attachment.
Thank you,
I'm not at all sure what you mean, when you edit the list the userform is "refreshed" and the combobox updated with the changes.
Hi,Therefore, I think that there is a relationship between The example find code and amendment code .. but I don't know what is it exactly??!!!
As I expected, There is a relationship between The searching Code and Amendment Code, which complete each other.
Searching Code's job is looking for the concerned record (selected by ComboBox) and stops on it by (Using Select property).
Then, Amendment code pastes the new changes to the recoded selected by Searching code.
Anyhow, I summarized the code to fit my need.
The only problem with this code is that it works only on the database sheet .. but when we run the code from another sheet, it doesn't work at all,![]()
Please Login or Register to view this content.
Therefore, for me the only solution for that is the trick I mentioned in My post # 14.
Thanks for all,
Hi,
Replace all your code with the following
HTH![]()
Please Login or Register to view this content.
Kris
Hi,
Thank you Krishnakumar for your reply,
Your codes are excellent, but I am so sorry to tell you that the problem is still existing
What is new in your codes is the following,
If ComboBox1 value was changed, the new values are not recorded in the first row of the list like previous examples, but they are added to the worksheet list as a new record.
Anyhow, I think the best and the most satisfactory solution for this case is creating a new Textbox and use the first one for employee name and the other one for badge number and ComboBox1 value will stay as it is without changing.
Thank you all,
Hi,
The problem is still existing .. the changes are still recorded in the first record.
I'm not sure what you are after.the new values are not recorded in the first row of the list like previous examples, ..
Let us know what exactly you need.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks