+ Reply to Thread
Results 1 to 21 of 21

programming userform buttons and text boxes and drop down.

  1. #1
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    programming userform buttons and text boxes and drop down.

    I am working on a userform to enter data where each data type may not have any units to input. What I would like to do is type in the invoice number. If it exists it will show the data for that invoice number. It will also show the first filled prime key with a number greater than 0. When I click next it will go to the next prime key with a value greater than 0, not the next row. If the index number isn't in the form, it will ask if I would like to create a new invoice. No closes the question and nothing changes. Yes adds that invoice # to the next blank line in the table and I have the ability to choose the prime key and enter a quantity for that prime key. Then click add. Adding does not add a new line, only a new quantity to the prime key currently selected. If there is a quantity already in that prime key I would like a pop up to ask if I'm sure I want to overwrite the current quantity. Close Closes the form and saves the worksheet. Oh and the description shows whatever prime key is chosen so prime key 2 would show the contents of C3 and prime key 3 would show D3 etc. I have no clue how to do any of this so even one bit at a time would be great. I attached what I have so far and included these instructions in the userform to simplify it for anyone helping. Thanks So much!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    There is code in there when I was trying to do something else but I may have to scrap it and start over with a lot of it.

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

    Re: programming userform buttons and text boxes and drop down.

    I have absolutely no idea what you are trying to achieve.
    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.

  4. #4
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Essentially a way to enter and retrieve data with a dropdown instead of a long list of entry boxes. On this sample file I only have 6 keys to enter but on the actual form I have over 1200. Each represents a type of work and has a dollar amount assigned to it as well as a quantity. For instance if I want intstall a gas main, I have assigned it prime key 1 and charge $10 for each installation as per listed in Row 1 Through 5 Column B through G. This would then have an invoice number to send an invoice to the client and track the progress of the job. If I need to look up an invoice I want to type in the invoice number and be able to look at what was on that invoice.
    Last edited by VShane; 12-27-2017 at 07:41 PM.

  5. #5
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Maybe this will help... Type invoice number into TxtInv. Press Enter ->Search column A for that number.
    If found Return the row number to "r" Fill TxtInv with Column A row r and fill CmbPrime with the first nonzero number found on row r between columns B through G. Fill TxtQty with the number found on the column with the non zero number. Fill TxtSubtotal with the result of multiplying the number filled in TxtQty by That same column row 5. Fill TxtTotal with the total of all the numbers in the row multiplied by the related column row 5 to get the total for the invoice. Clicking next will go to the next nonzero number on row r.

    If not found -> message "Not found, would you like to create one?" If no, wait for user to input different data. If yes, Add to the first blank line the number typed into TxtInv. Then the user would select a number from CmbPrime to choose which to add. User inputs quantity into TxtQty and clicks ADD. When Add is clicked That qty is added to that invoice number row with that prime key column and saves the worksheet. If the user chooses another number from CmbPrime He can click add and add that to row r. Once user is done entering data he can click close to close the userform. User may also type in a different number into TxtInv to start over.

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

    Re: programming userform buttons and text boxes and drop down.

    I see what you are trying to achieve.

    This is how I would approach the task.

    Keep column 1 for the Invoice Number.
    use columns 2 to 1201 for your 1200 keys.
    Use Row 1 for your Descriptions
    Use Row 2 for the Unit of measure
    Use Row 3 for your current cost.

    Use Rows 4 downwards for your Invoices.

    Use Text boxes to store your Quantities, Number your textboxes according to the columns where the data is stored.

    Use a label to store your descriptions, Number your Labels according to the columns where the data is stored.

    This code will load all the Labels with the correct text.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by mehmetcik; 12-27-2017 at 08:48 PM.

  7. #7
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    That is essentially what I have. The only difference is an added short description for the type of unit which I don't need. As far as using text boxes to store quantities and numbering text boxes according to the columns and labeling my descriptions gives me a huge form. I am trying to keep the form small and not have all 1200 text boxes listed. This is why I was wanting to code the combo box to select which column to enter the data.

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

    Re: programming userform buttons and text boxes and drop down.

    That route is not viable.

    Try it. Selecting one of 1200 entries using a combobox is impracticable.

    A better solution is to use two or more text boxes: meter, gas, bluetooth

    Use those boxes to filter your data and list the results in a listbox or combobox

    Selecting an entry would transfer that entry to a second listbox.


    I cannot look at that tonight.

    But userform3 on the attached workbook.

    Triggered from sheet "Search - Read - Write" will get you started.

    Open the userform

    type joh in one textbox

    type p in another
    Attached Files Attached Files
    Last edited by mehmetcik; 12-27-2017 at 09:52 PM.

  9. #9
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Your form had an error when I tried to run it. And I could use a txt box instead of a combo box, but my point is I can't have 1200 text boxes. I need one that is populated with the data and click next to go through any nonzero numbers. Instead of choosing one in a combo box, I could type which unit in a text box, but the rest of the coding would still need to be the same.

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

    Re: programming userform buttons and text boxes and drop down.

    Try this sample.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    That's much more like what I am looking for, thanks. Now to just get it working! I need to be able to add to a new blank line and this seems to only overwrite, also when selecting an invoice, I need to be able to edit it through the form. Also the filter doesn't seem to work and I need the prime key label on there on the table it loads, preferably at the beginning rather than the end. Thanks. I'll play with what you have given me and see if I can figure it out.

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

    Re: programming userform buttons and text boxes and drop down.

    1. To add a new line. Save an invoice with no invoice number.

    2. If you select a line in the listbox it is copied into textboxes, edit the textboxes and then click on amend.

    3. The filter works if you type two characters.

  13. #13
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    If I save without adding an invoice number then it doesn't allow me to control the invoice number. I need to be able to write in the invoice number as this is one of several jobs. For instance Job1 may have invoices 1-3 Job2 may have 4 & 5 and Job 3 may have 6-9 then Job 1 may have 10-14. I need one of these sheets in each job folder, but the invoices must be manually input as part of the data.

  14. #14
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    And I realize I can type the invoice in after saving and then save again to change it, but that seems like a waste of a step that can cause errors that should be easily fixable with code. Whenever you click save it checks if the invoice exists. (This is standard coding practice for error checking) if it does exist I have the option to overwrite, if it doesn't then I can create a new one.

  15. #15
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Also the load button is getting an error when I create an invoice that way. It loads the rest, but not the newly created one.

  16. #16
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    And when I add a unit, if I don't add one to the I column, it is #N/A

  17. #17
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Bumpzzzzzzzzz...

  18. #18
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Made a few modifications, but I'm still not able to input prime key 9 and when I save a new invoice row of data, prime key 9 gets #N/A in the row.
    Attached Files Attached Files

  19. #19
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Private Sub CommandButton3_Click() is where the problem is.

  20. #20
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Bumppppppp

  21. #21
    Registered User
    Join Date
    12-15-2017
    Location
    Fresno, CA
    MS-Off Ver
    2016
    Posts
    56

    Re: programming userform buttons and text boxes and drop down.

    Nobody is responding to my post. I'm wondering if I should just find another forum...

+ 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] Populate different text boxes using command buttons
    By Nathan_s35 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-01-2015, 04:39 AM
  2. [SOLVED] VBA Radio buttons that select multiple UserForm check boxes
    By Darkenergyz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-14-2014, 12:13 PM
  3. [SOLVED] Clear all text boxes-combo boxes in a userform.
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2014, 11:16 AM
  4. [SOLVED] Help with code for userform text boxes, combo boxes and excel
    By innerise in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-20-2014, 09:07 AM
  5. Text boxes,cursors and command buttons
    By slmi1313 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2009, 03:41 AM
  6. Replies: 4
    Last Post: 10-11-2006, 11:54 AM
  7. [SOLVED] buttons and boxes in userform
    By Larry Sartoris in forum Excel General
    Replies: 3
    Last Post: 01-20-2006, 12:45 PM

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