+ Reply to Thread
Results 1 to 21 of 21

read data from table in userform

  1. #1
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    read data from table in userform

    Hello

    I have userform and I want to read/edit/add data from my userform to my table

    user.png

    This my userform,

    for read : I want if user write ITEM number in userform, the userform get the current data for the same item number in my table
    edit and add : then user can edit the data then can click add, to add the new values to same cells within the table with the item number selected
    once click add, let ITEM textbox fill with the last item number in my table with empty data

    dont worry about expand table if its full, I can handle it later
    note: the data in the userform in the photo written by me to explain the read function I need
    Q : May I know why if i click TAB, why not switch to next box to the right?, its switching diffrente

    Thanks
    Attached Files Attached Files
    Last edited by Undo; 10-01-2020 at 02:48 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: read data from table in userform

    1. Each Control has a tab number consistent with the order that they are created.

    2. The Tab numbers can be adjusted in the properties window.

    3. I have renumbered your textboxes so they correspond to the columns where the data is stored.

    4. I have reset your tab indexes to match.

    You can now load your data using this code:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 10-01-2020 at 05:59 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    @mehmetick

    I think you forget to upload the file

  4. #4
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    Great work bro, now I can load the data, waiting for someone to help me with second point
    Quote Originally Posted by e97h View Post
    Hello

    edit and add : then user can edit the data then can click add, to add the new values to same cells within the table with the item number selected
    once click add, let ITEM textbox fill with the last item number in my table with empty data

    Thanks

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: read data from table in userform

    Before that.

    You need to define your requirement.

    I have stored your table in VBA so you are not always reading and writing between Excel and VBA.

    Option 1. You can update the data in vba and save it when you are done

    Option 2. You can update the data as you update the textboxes.

  6. #6
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    sorry but I dont understand, I see it its reading all fine

  7. #7
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    if u mean live update or no
    I dont want live update, once user finish, if he want save he will click add item button
    and let once userform run, switch for next empty item to avoid writing upon filled item ( same when click save .. auto go to next empty item )
    dont add anything about table expanding, i will handle it

  8. #8
    Registered User
    Join Date
    09-28-2020
    Location
    Liverpool
    MS-Off Ver
    2016
    Posts
    4

    Re: read data from table in userform

    hi sorry if iv posted on your thread, cant find how to start a new thread
    Hi am trying to make a booking form for a dog agility field with a date and time slots have near enough done it the only issue i have is double booking so i would like to within the book cmd button to check the monthview1 in the data sheet and to check if the time is available on the chosen date.

    any help would be massively appreciated, hope this make sense below is the code i have which the booking form work fine with.

  9. #9
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: read data from table in userform

    @bradley.cave
    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

  10. #10
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: read data from table in userform

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    @mehmetcikt

    COOL, you almost get my point

    1- the last code you give, Its add items in table ( without read and edit ), I don't know if I shall mix ur first + sec code, I add only use the second one
    2 - for ITEM textbox, I need it only read from table to know the selected row, don't print item textbox value in table when I click ADD
    3 - once userform open or ADD ITEM button finished, ITEM textbox should switch to first ITEM row in table that have empty HS CODE

    again, user can use userform in two ways

    WRITE PLAN
    1 - once user open userform
    2 - ITEM textbox filled with first ITEM number in table that have empty HS CODE ( if none, textbox value = "", waiting for user to input item number )
    3 - user fill the boxes, then click ADD, data will printed in the row for selected item number in item textbox ( don't print ITEM textbox value into table )
    4 - after finish ADD Button codes, let ITEM textbox auto go to next first ITEM number in the table, with empty HS CODE ( same point 2 ), note : Don't add new ITEM lines, if there no empty row item textbox value = ""

    EDITE PLAN
    Same for 1 and 2 in WRITE PLAN
    3 - if user change the ITEM box number, then load the data in the row with this item number,( if user didnt change item textbox, mean we are still in write mode )
    4 - user can edit the data, and if he click add, update the data in selected item row ( dont print item textbox value )
    5 - same point number 4 in WRITE plan

    thats all, its easy but I must explain like this
    note column A, its for read only dont change anything in this column, let userform work with exists ITEM number, no need to expand table if its full

    kindly upload excel file, better than give me the code
    sorry for delay, Thanks
    Last edited by Undo; 10-02-2020 at 04:57 PM.

  12. #12
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    anyone can go ahead?
    thanks for @mehmetcikt, I think he is busy and can't continue

  13. #13
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: read data from table in userform

    upload your very latest file so that we know what you are talking about.
    torachan.

  14. #14
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    @torachan , updated latest
    and only need fix that points I write it in reply number 11
    Attached Files Attached Files

  15. #15
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: read data from table in userform

    I will leave it to others to help you.
    The logic is too confused for me, I need to see clarity of thought to make it worthwhile helping.
    torachan.

  16. #16
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    @torachan

    its not thats hard, but maybe I didn't clear and write it easy
    this short video for what I need

    https://drive.google.com/file/d/1PXZ...ew?usp=sharing

    Thanks
    Attached Files Attached Files

  17. #17
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: read data from table in userform

    I did not say 'I do not understand', I said 'your logic was confusing'.
    re-arrange your opening sentence and apply in logical order, "I have userform and I want to read/edit/add data from my userform to my table"
    Firstly how to place data in table, then how to recover that data for editing, then how to remove that data.
    Also before proceeding any further, familiarise yourself with tables and their appropriate use, especially methods of adding/retrieving data within a table.
    If you apply the methods in the link below you will find tables expand and contract with ease.

  18. #18
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    @torachan

    Thank you for ur links

    now I got this code, its only read from table, just need add code in ADD button to update the data within selected item number in textbox1
    Please Login or Register  to view this content.
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    UPDATE, Now My code can add new items, and read items, but just need small edit to can update the readed data, all fine, only its not updating data

    Please Login or Register  to view this content.
    Attached Files Attached Files

  20. #20
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,304

    Re: read data from table in userform

    Attached simplified method of dealing with your data.
    To add a new row first clear the form this will increment the row.
    There are no search routines in the code, the update and delete know the row by reference to the selection (listindex) of the combobox.
    with all the variables declared at the head of the userform module they are available to all the subs within the userform module.
    torachan.
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    919

    Re: read data from table in userform

    Thank you dear!

+ 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. Replies: 6
    Last Post: 10-01-2018, 01:31 AM
  2. [SOLVED] Populate TextBox value from Pivot Table based on other UserFrom fields
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2018, 10:59 AM
  3. [SOLVED] Vlookup/Match - Read Data from 1 table using a value from another
    By oblah in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-17-2017, 12:11 PM
  4. Drop down box to read data from a table?
    By d3ell in forum Excel General
    Replies: 3
    Last Post: 01-20-2012, 10:49 PM
  5. Replies: 4
    Last Post: 11-10-2011, 04:43 AM
  6. Excel 2007 : How to Read RSS/XML into Data Table?
    By ice1000 in forum Excel General
    Replies: 0
    Last Post: 06-25-2011, 07:10 PM
  7. Help with userform (trying to read data from table into combo list)
    By EK1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2010, 10:18 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