Search & Edit VBA Code For Userform

raindrop
Lounger
Posts: 36
Joined: 04 Feb 2013, 06:22

Search & Edit VBA Code For Userform

Post by raindrop »

Hi!

I want VBA code for userform2 to search info about any member by entering member number or member's name and after editing info with update button change should be saved in my database. Please have a look at my attached example file.

Thanks & Regards
Raindrop
You do not have the required permissions to view the files attached to this post.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Search & Edit VBA Code For Userform

Post by Rudi »

As an alternative, and before going into custom VBA to built your forms, why not just use the built in Data Form that Excel provides?
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Search & Edit VBA Code For Userform

Post by HansV »

If you want to use the userform, I wouldn't use the same text boxes for searching and for editing, that would be very confusing. I'd use either a text box or a combo box for searching, and other controls for editing.
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Search & Edit VBA Code For Userform

Post by Rudi »

Here is a working sample of the built in user form that Excel provides. You can add, search, edit and delete records using this form.
R1.xlsm
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

raindrop
Lounger
Posts: 36
Joined: 04 Feb 2013, 06:22

Re: Search & Edit VBA Code For Userform

Post by raindrop »

Thank You Rudi Sir,

It was nice for your kind help about providing built in user form. Herewith I am attaching a sample file with little bit afford to my custom userfrom, that let me enters new data up to column J. But search gets me data to edit up to column G only that i want to extend up to column j or may be more. I am confused with code.

Thanks & Regards
Raindrop
You do not have the required permissions to view the files attached to this post.

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Search & Edit VBA Code For Userform

Post by Rudi »

Hi Raindrop,

You needed to give the additional controls Tags (the Tag property) so that the code can collect data from the column that matches the tag and fill the textboxes with the values from those columns based on the search row.

Try it now.
Attached....
R1.xlsm
PS: I'd still prefer to use the built in form (IMHO)
2014-03-19_07h24_00.jpg
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

raindrop
Lounger
Posts: 36
Joined: 04 Feb 2013, 06:22

Re: Search & Edit VBA Code For Userform

Post by raindrop »

Rudi Sir,
Thank you very much for help, little more things I knew.