+ Reply to Thread
Results 1 to 72 of 72

VBA Userform - Search, Edit & Update functionality

  1. #1
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    VBA Userform - Search, Edit & Update functionality

    Dear Excel Forum users,

    I have created the attached database including a VBA Userform ‘MacMonitoring’ (linked to the ‘MacMonitoring' worksheet) which allows me to add a new client to my database (MacMonitoring sheet).

    I have replicated the User form and called it ‘MacMonitoringUpdate’. I want to use the replicated form to add a 'Search' and 'Édit/Update' option, presumably using command buttons within the Userform itself.

    I am struggling to come up with VBA code. When searching i'd ideally like all the criteria in the userform to populate based on a surname or first name search with a 'Find Next' function. When executing the Edit/Update option i'd like it to replace the row of existing data rather than populating a new row.

    Any help would be much appreciated - sorry i had to send file as a zip file.

    Thanks
    Motoka
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Hi, welcome to the forum.
    Read your PM, will see what I can do for you, wondering why the zip file? No problem to unzip but just curious.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Hi Motoka,
    Before I dig into this.
    The update userform as you mention is a 'replicated' version of the input form.
    This is an overkill and makes it very unfriendly maintenance wise.
    How is your VBA knowledge? As far as I can see at first sight of the input form your starting.
    Does the input form work as it is now?

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    First suggestion:
    Add a worksheet and place all the drowdown list items in separate columns with as header the name for that list
    You don't want to edit your VBA code every time a new item is added or removed or needs to be edited.
    This is one step to userfriendly maintenance.
    Of course we can all paste and copy and create them for you but ... we just try to help and advice, building entire applications is all together another thing

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    This is one example of incorrectly placed code:

    Please Login or Register  to view this content.
    The marked text in read should be a separate macro so you can invoke it from other sections.

    See below

    Please Login or Register  to view this content.

    Another important thing. which are the mandatory input fields? Have you thought of that, you cannot just update a database and 'forget' manadatory fields, your data will be worthless unless that is clear and forced before the user presses Add Input or Add record or whatever

    You've still got some homework to do

  6. #6
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Hi, the file was to large to upload - it was approximately 5000 kb, maximum allowed is 1000 kb. Thanks

  7. #7
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Hi Keebellah,
    My VBA knowledge is very basic.
    I am up for any suggestions. If it makes the form unfriendly maintenance wise, then i can have just one form to use for both adding new clients and and editing.
    Yes the input form works as it is now.
    Thanks

  8. #8
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    The Input form does not have any mandatory input fields as sometimes some of the information received is missing e.g. surname or first name might be missing on the hard copies. This is why i need an edit / update option on the form to add these details at a later stage. I want to add a lookup function that returns records from the worksheet so i can edit / update the record on the form.
    Please advise. i can get rid of the replicated form and keep one form (the Input form) then add a lookup option? What do you think?
    Thanks

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    I still think you need to mark mandatory fields and then for example enter missing or required as text, could also help when looking for records that need to be edited for completion.
    I'll see how far I get, BTW according to the file size unpacked I don't see a size issue, but, we'll see,

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    My fist idea, no code just to show.
    Have to go away now but this is my idea for the Userform
    Attached Images Attached Images

  11. #11
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Many thanks for your help on this, very much appreciated. all suggestions are taken on board.

  12. #12
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Your idea looks good. Thanks

  13. #13
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: VBA Userform - Search, Edit & Update functionality

    Here you have a working example.
    I added a column with automatic number,if you edit a client excel uses this number to find the client.
    Have a good look at the names i use for the controls (textboxes, comboboxes)
    If you look at the Listbox click event there you can see wy I use these names.
    I also work with a real table in the MacMonitoring sheet.
    Attached Files Attached Files
    Click the * Add Reputation below to say thanks.

  14. #14
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    @dotchiejack: looks great, the light blue and white letters are less, but that's a user's preference.
    I would add prompts verifying is you want to Add, Edit (missing Delete) and yes the real table that was something I didn't mention to the OP but makes it manageable.
    You did a good job, I can lay back and rest

  15. #15
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Hi Dotchiejack

    Many thanks for this working example – been in the back end of your example and saw stars with your coding (very different to mine – will need a few lessons to edit it in the near future).
    Just a quick one, when you select a client to edit or when the form is in editing mode, and you click the ‘ADD’ button, this creates a duplicate record. Is there a way around this i.e. disabling the ‘ADD’ button when the form is in edit mode?

    Also the the ‘Total Gain’ column/ field is an auto sum of gian1, gian2, gian3, gian4 and gian5. Is it possible to add a formula which sum gain 1 – 5?

    Many thanks again for your help, much appreciated.

  16. #16
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Thank you Keebellah

  17. #17
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Hi Dotchiejack
    Many thanks for this working example – been in the back end of your example and saw stars with your coding (very different to mine – will need a few lessons to edit it in the near future).
    Just a quick one, when you select a client to edit or when the form is in editing mode, and you click the ‘ADD’ button, this creates a duplicate record. Is there a way around this i.e. disabling the ‘ADD’ button when the form is in edit mode?

    Also the the ‘Total Gain’ column/ field is an auto sum of gian1, gian2, gian3, gian4 and gian5. Is it possible to add a formula which sum gain 1 – 5?

    Many thanks again for your help, much appreciated.

  18. #18
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: VBA Userform - Search, Edit & Update functionality

    Hello,

    Looking at Dotchiejack's form, there was a named range which I could not figure out, how it was formulated as I could not replicate it.

    Can you please explain how did we get the NRs by using the Data_tbl name range?

    Test3.PNG

    Amazing work this is, really great one. Well done.

  19. #19
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: VBA Userform - Search, Edit & Update functionality

    @ Keebellah
    I used the blue from the labels of TS.
    for the rest I made an example according to the title "Search, Edit & Update functionality "
    @ motokaxperts
    I'll make the required adjustments tomorrow, now I lay back and rest.
    @rakotonirinas
    1. make a table (in my example data_tbl)
    2. select the filled cells in column A from your table (one record in the table is enough)
    3. Click new.
    Last edited by dotchiejack; 04-25-2019 at 01:00 PM.

  20. #20
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Thanks Dotchiejack. Will be waiting.

  21. #21
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Using Dotchiejack's file I made some changes and added the calendar entries, you will have to set it to your date format.
    The DELETE record is not written.
    Still much fine tuning to do but you'll work it out, was fun
    Attached Files Attached Files

  22. #22
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: VBA Userform - Search, Edit & Update functionality

    Hello,

    1. make a table (in my example data_tbl)
    2. select the filled cells in column A from your table (one record in the table is enough)
    3. Click new.
    *****
    @dotchiejack: I'm still confused. I could not replicate it.

    I have created the table, then filled some cells in it and selected one filled cells in the column A. Now, I think this is where I get it wrong as clicking New doesn't add the table reference in the Name Range as er yours, which is NRs=data_tbl[Nr.]

    What a I missing?

    Thank you.

  23. #23
    Valued Forum Contributor dotchiejack's Avatar
    Join Date
    05-21-2015
    Location
    Antwerp,Belgium
    MS-Off Ver
    2016
    Posts
    507

    Re: VBA Userform - Search, Edit & Update functionality

    filled some cells
    You have to select all the filled cells.
    What I mean by one record is enough.
    If only cell A2 is filled than select that cell to create the range. (Don't select A1 = header)
    If more cells are filled in column A then you have to select all these cells. (Don't select A1 = header)

  24. #24
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: VBA Userform - Search, Edit & Update functionality

    Brilliant! My error was at the table level. I did not properly set it up. Working absolutely like magic now. Thank you.

  25. #25
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Many thanks Keebellah with the above changes.

    Might need help with the ‘Delete’ code.
    Also, calendar pops up only on first click, is that what supposed to happen?
    ‘New’ button, after adding record and clicking ‘Save’, ‘New’ button reverts to ‘Edit’ instead of ‘New’?
    On ‘Open form’ Is it possible to have the cursor in ‘surname’ field rather than the ‘customer search’ field?

    Thanks

  26. #26
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Calendar pops up only in calendar fields

  27. #27
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Got your PM, understood, still, it can come in handy to do it using a button on a userform
    I must add that dotchiejack has not taken advangate of all the table functionality but it works great

  28. #28
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Ok Keebellah, are you gonna help me with the 'Delete' coding?
    How about the 'New' button query?
    'Open Form' query?
    Also, is it possible to disable the 'Total Gain' field on the form (as this wont require to be in put by the user? similar to the 'NR' field.

    Many Thanks

  29. #29
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    I had already assumed about the Total Gain.
    Delete is fixed (coded)
    This link explains all about tables, interesting to dig into
    https://www.thespreadsheetguru.com/b...t-excel-tables
    File's got a new name.
    What do you mean with the 'Open Query'?
    Attached Files Attached Files

  30. #30
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Nice one Keebellah, thanks.

    What i meant is, when the form has just opened, the default field ideally should be the 'Surname' field at the top rather than the 'Customer (Surname)' field reason being that the form will be used more to input records than editing records).

    Also, all the Gain £ fields have been disabled, its only the 'Total Gain' field that should be disabled.

    Thanks

  31. #31
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Have you even tried entering a number in the gain fields? If
    The fact is only numeric input is allowed and since you already mention that the values are in £ all you need is the amount
    You keep mentioning the Surname, why don’t you tell me which one you mean? You can edit it yourself if look at the code

  32. #32
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    The reason is that you need to click on NEW and then you start to enter data.
    When you start the search is the default.
    About the gain, only numeric values allowed since the pound sign is already in the cell formatting of the table asn you mention the pound sign in the form.
    I did not see any decimal values so only whole numbers are allowed, no decimal sign and since you have the code now you can work on that and change whatever you want.
    I still think (suggest) you need to set a list of required fields and check these BEFORE saving a new or edited record, that's how data manipulation en data entry works, if data is incomplete well, it's the responsibility of the person or persons entering data. This if you want serious and trustworthy data
    Attached Files Attached Files
    Last edited by Keebellah; 04-27-2019 at 02:28 AM.

  33. #33
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    I think with the attached PDF and the file you will get the gist of it all.
    VBA is not at all that difficult and it all boils down to logic and step-by-step instructions.
    Read the code like you would a book, line by line, chapter by chapter, the same way you can write VBA code if the value of a is equal to the value of b then do this and that else do something else unless z is equal to y etc, etc, etc.
    Important ingredients are Time, lots of it, imagination and perseverance (for troubleshooting) and you'll get far.
    We all stated with the message box 'Hello World'
    Enjoy your weekend
    Attached Files Attached Files

  34. #34
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Many thanks Keebellah for your assistance on this, the form works ok.

    What I meant with the Surname name in my earlier post, was that instead of ‘the Search Customer Surname’ being the default when the form starts, I preferred ‘surname, in the ‘Customer Details’ section of the form to be the default since the form will be used more to input records rather than editing. (This means that when the form is opened, user is ready to input records instead of having to click ‘New’ first. I ope I didn’t confuse you.

    PS: Thanks for the attached guide, will definitely have a read.

    Happy weekend

  35. #35
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    It doesn’t confuse me but you’re the one working with it
    All you need to do is add Cmd_00_Click as the last line in the Userform_Initialize section, just before the End Sub

  36. #36
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    @Dotchiejack: a cosmtic tip, I ran into the similar lists in other posts and was finding a simple way to solve id and I think this one does the trick.
    You seen when a user starts typing in the search box he/she can go on typing even if there is no match, like if the user type farmmmmmmmm all the m's continue but there is no hit.

    I added the red portion and the it just stays showing farm even if you time more m's or whatever after it.
    Give it a run and you'll see what I men

    Please Login or Register  to view this content.

  37. #37
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    I noticed I had forgotten the code for the Diagnose date
    It's there as well as my 'cosmetic' correction for the search box
    Attached Files Attached Files

  38. #38
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    As said the updated V1.2 file in the post, defaults to NEW when opened and every time the record is saved.
    Mandatory fields at least Surname and DOB
    Attached Files Attached Files
    Last edited by Keebellah; 04-28-2019 at 04:56 AM.

  39. #39
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Fantastic Keebellah, thank you.

    One issue i am having with the form, when its in edit mode, after editing the record, and clicking 'SAVE CHANGES', the workbook crashes?

  40. #40
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Didn't test that, probably because of the fact that you want it to start in NEW RECORD more.
    Will check and see if I can avoid the crash

  41. #41
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Fund it, won't go into details but it no longer crashes.
    Attached Files Attached Files

  42. #42
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Good morning Keebellah

    Nice one, sorted - all looking good. Many thanks for your assistance and expertise on this, very much appreciated.

    Thanks

  43. #43
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Joint effort, dotchiejack had the greatest share in rearranging the form into a logical way and the listbox, I just did the functionality

  44. #44
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Sure, i did thank dotchiejack in my previous posts.

  45. #45
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Thank you @dotchiejack, thank you @Keebellah for the joint effort. you are both stars!

  46. #46
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    There is an option, but it doesn't zoom correctly, I don't know what dotchiejack did but the last frame on the right does not fit in as it should.
    This is the code I have but it doesn't doe a grate job
    Please Login or Register  to view this content.
    Just past the code above in the macmfrm (userform) code, no exta just past it there and open the form.
    If it's no good, just remove it.

  47. #47
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    The code I sent is not really good you could just for now manually set the userform's zoom factor to 75.
    Add the line in UserForm_Activate
    Please Login or Register  to view this content.
    Ýou need extra code that measures the width of your screen and then set the zoom factor accordingly.

  48. #48
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    I did some searching and tried something out, I don't have a laptop to test it but could you give this a run?
    It determines the initial zoom factor based on the screen's resolution
    Attached Files Attached Files

  49. #49
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Thanks Keebellah

    That does not seem to work. i think i will have to manually play with the 'Me.Zoom=75' or 90 when using the laptop. Thanks Once again

  50. #50
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    You have to play around with this part od the code, the tZoom value is the one you need

    Please Login or Register  to view this content.

  51. #51
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Will do, many thanks Keebellah

  52. #52
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    I've got a laptop with a smaller screen (11") and will try it on that one tomorrow and if I get the fit right I'll let you know

  53. #53
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    No worries Keebellah, thanks once again, much appreciated

  54. #54
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Hi, I think I got it working like I wanted and you needed for your use
    Based upon the screen resolution the userform's zoom factor is determined and resized.
    If the monitor is a 34" then the userform will not go to 125% but stay at a 100% of the original size, only lower resolutions and smaller screen sizes will be processed accordingly.
    Give it a run and let me know, I think it works.
    Tried it on a 15" laptop, the 11" tablet is disconnected at the moment.

    File version upped to 1.2.2
    Attached Files Attached Files

  55. #55
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Hi Keebellah

    Many thanks for this. just tried opening it on a 15" and 13.5" laptop and form fits nicely in the centre of both laptops. But still the same size on desktop as laptop

  56. #56
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Edited:
    I see what you mean, back to the drawing table

    Ignore the quote below

    If I understand you correctly, is this okay? Or do you want it bigger on the desktops?
    You could play with this line:

    Please Login or Register  to view this content.
    Change the 1 to 1.2 (and not greater than 1.25) I think and see what it does
    Last edited by Keebellah; 05-01-2019 at 05:00 PM.

  57. #57
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Will test what I have now tomorrow, is past midnight

  58. #58
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Well, entirely different approach and the extra functionality to allow resizing the form when you click and drag a border.
    Can you give it a try? It looks okay on my 11"tablet
    BTW you may not add a caption to the userform's title bar, if a caption is present the resizing is blocked
    Let me know how it goes
    Attached Files Attached Files

  59. #59
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Hi Keebellah

    That seems to do the the magic - it allows the resizing and moving of the form. only issue i have encountered is that i get an error message (see attached image) sometimes (not all the time) when i try to resize / move the form. have a go at resizing form a few times and see if you get the same error message. Many thanks

    Attachment 622613

  60. #60
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    The screenshot with the error message isn't attached or is corrupted, cannot open it.

  61. #61
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Attachment 622734

    Trying again

  62. #62
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    You're doing something wrong this is the result

    What's the error anyway?
    Attached Images Attached Images

  63. #63
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    I tried it all but no errors,
    I did place the bottom buttons in a separate frame
    Attached Files Attached Files

  64. #64
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    This is the error am getting:

    Run-time error ‘384’:

    A form cant be moved or sized while minimized or maximized

  65. #65
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Ok, let me try this one. Thnaks

  66. #66
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    NB: That error only comes up when i try resizing or moving form on a laptop. When i try resizing / moving form on desktop, i do not get the error.

  67. #67
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Thee is a point that it’s maximized for the laptop, no way I can change that, or at least know how to overcome this

  68. #68
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    No worries Keebeellah, That's minor, at least i am able to resize and move the form. Much appreciated with all your help - i think the form is good to go. Thanks once again

  69. #69
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    I think that the reason this happens is that a certain point the userform snaps to full screen when expanded and then the resizing is indeed impeded

  70. #70
    Registered User
    Join Date
    04-24-2019
    Location
    Manchester
    MS-Off Ver
    2010
    Posts
    95

    Re: VBA Userform - Search, Edit & Update functionality

    Ok - Thanks

  71. #71
    Forum Contributor
    Join Date
    09-02-2013
    Location
    London
    MS-Off Ver
    Excel 2019
    Posts
    368

    Re: VBA Userform - Search, Edit & Update functionality

    Hello there,
    Apologies if I am posting on this thread.
    I have created a table on a worksheet and I would like the data from the table to be shown as a list on an userform, similar to the workbook given on this thread. The issue is when I try to initialize the form as per below, I got the Compile Error: Method or Data Member Not Found. Unsure what I'm doing incorrectly as it seems to be simple for this transfer to be initialized.
    Please Login or Register  to view this content.
    I really appreciate if you could shed light on this for me.

    Thank you.

  72. #72
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: VBA Userform - Search, Edit & Update functionality

    Hi, Will you please be do kind as to create a new post?
    Thank you
    Last edited by Keebellah; 06-21-2019 at 03:18 PM. Reason: Typing error

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Search and Update functionality
    By 323100N in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-21-2019, 05:40 AM
  2. [SOLVED] Userform - Search, Edit & Update
    By nancyching1711 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-09-2018, 05:34 AM
  3. USERFORM : Search and edit data in userform
    By mohit.kumar9094 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2018, 07:50 AM
  4. [SOLVED] Excel Userform - Advanced Search and Filter Functionality
    By KieronPelling in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-07-2017, 04:22 AM
  5. [SOLVED] VBA Userform - Search, Edit & Update functionality
    By camp2chiawa in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-15-2016, 03:43 AM
  6. [SOLVED] VBA Userform Edit/Update record help
    By sa.1985 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-20-2013, 10:29 AM
  7. update value and edit items already update on sheet by userform
    By tjxc32m in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-08-2013, 10:13 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1