hiya, yeah it would be the add patient one.
Search edit and update using userforms
-
DariaLoveborn -
May 25, 2020 at 1:08 PM -
Thread is marked as Resolved.
-
-
-
I'll amend it for you and attach it tomorrow.
-
Amended workbook attached. Please let me know if it needs any changes.
-
Hi Roy,
I've downloaded the attached but it seems to be the same sheet I uploaded yesterday.
-
I've amended the userform. You will need to delete row 4 though.
-
-
But the userform is still identical to the one I uploaded?
-
No it's not. I've replaced the ID TextBox with a ComboBox and changed the code. I've downloaded my attachment to check.
-
I've amended the addpatient form. The OK button will add new if type the new ID into the ComboBox or edit an existing one if you select from the drop down.
There is no Edit Button. and only one worksheet in the example workbook.
Test it as it is and then I will explain how to move the userform to another workbook correctly
-
Hiya,
When I search a reference in the userform I'm getting run time error 381 on this line:
.TextBox4.Value = .cboID.List(.cboID.ListIndex, 1)
Any idea what it might be?
Thanks
Jen
-
I think it's because I'm typing into the combobox but with over 800 lines of data, typing will be the best way to locate the reference. Is this something we can amend?
-
-
No. That was the who;e point of my reply. Typing into a ComboBox will autotype and try to anticipate what you need, you just keep typing until you have the right ID. A ComboBox will help eliminate input errors as I said in my reply yesterday.
My method has been used in bigger databases than 800 entries.
-
I understand that and I agree that a combobox is an excellent method but as soon as I type the first number it gives me runtime error 381 which stops me from typing any further. When I click debug it takes me to the line of code I posted above. But I dont know how to troubleshoot the error.
-
Just been playing around. Feel free to ignore
-
Hi Trunten,
This works well! The only thing is, if i freetype into the search, it doesn't bring anything up.
Other than that, it's really great!
-
I've fixed the error that you get when typing, but I am trying to get it to fill the other boxes as well. The problem is typing into the ComboBox does not change the ListIndex even if the ID exists
-
-
That's brilliant, Roy. I appreciate you working on this. I'm afraid I'm not even useful to bounce ideas off.
-
This should work when you type in an existing number
Type the number into the ComboBox then tab to the next box, if the ID is listed the others will autofill
-
it works perfectly. I just pasted my data into the main sheet and it works a treat
Thank you so much
-
Did you paste it into the ComboBox?
To transfer the UserFor, all the code is in the UserForm so
- Open both workbooks.
- Open the VB Editor as usual
- Make sure the target workbook does not have a userform with the same name.
- Now simply drag & drop the addpatient form into the other workbook.
You will need to add code to open the userform to your button
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!