Posts by DawidV

    Re: Listbox Initialize and Click event giving runtime error

    Hi Pike

    Me again.

    I have made some changes to my code and now I stuck with the Search Function. I only wrote the code to search on the Force No hut am getting an error in the code.
    I have tried everything that i can think of but nothing is working.

    Sorry I said i will be back.



    Re: Listbox Initialize and Click event giving runtime error

    Morning Pike

    Thanx for the changes. I can only laugh at myself. :smile: It took me a whilw to realise that I must only change the TAG No in the Properties!! I just shows my inexperience with Excel.

    I am going to start on the Edit/Save today so I am definitely going to come back to you.

    Thanx again with helping.

    Re: Listbox Initialize and Click event giving runtime error

    Hi Pike

    This is the code that I managed to write and it is working, but not to my satisfaction. I do not like message boxes as you saw in my code they ar not there.
    I like the colour code part, works better for me.

    The TextBoxes that is Comment Out is the only TextBoxes to be checked for empty. The other TextBoxes has other code and functions linked to them. e.g.

    The Textboxes with same names must be populated once the the record has been saved and you use the Get Record or the Edit Record as we will be using the Surname and Force No to do that with.

    My code now checks ALL TextBoxes and turns them rgbHotPink and i only want to check some of the CheckBoxes. If I use the code you helped me with I am not sure how to incorporate my validation part in the code.

    Thanx again

    Re: Listbox Initialize and Click event giving runtime error

    Hi Pike

    I love ya man!!! It is working much better now and my code is much cleaner/leaner as well!!!! Really appreciate it!!

    I wrote a piece of code

    Private Function EverythingFilledIn() As Boolean

    to check if all text boxes are filled in before user can save. I did that with the help of YouTube, books and the Forums. It is now checking for empty TextBoxes on the whole userform but it must only check specific TextBoxes. In my original code that I attached I left it below the Loop. The idea was to comment the Loop out and then use the other code but i think it is possible to only check specific TextBoxes with the loop. I just do not know how to do that. I posted a question a while back asking for help with this but received no response up to now.

    As you see with my userform I would like to use the Listbox to Edit and delete records once we start using the userform. If I hide some of the columns in my ListBox as you suggest in Post 4 will I still be able to do that, e.g. Edit/Delete by double clicking on a row to fill the userform to Edit/Delete?

    This is a serious work in progress, I am still busy with the other buttons and with the help of YouTube, books and the Forums I will get there eventually.

    Thanx again for the serious help with this.

    I really appreciate it.

    Re: Listbox Initialize and Click event giving runtime error

    Hi Pike

    Said I am doing something stupid here.

    I understand the part about the Sheets Activate. thanx it is working now by adding the scrollbar.

    My question about the "Textbox" is the following. As you can see in my code I give the TextBoxes proper names starting with "txt". How will I then sort the problem in the error part?

    As the code is now set up it takes the columns from A to U and place them in the Listbox. I however only want to place 21 columns in the Listbox but they are of my choosing and not necessary from A to U. how will I do that?


    Hi All

    I am having a serious problem with getting the listbox to populate properly. I know I am doing something stupid here but i am looking over it.

    I am trying to populate my Listbox with the 21 fields and as in the Initialize Event. Only 11 is showing and I do not want to include the numbers on the left.
    I know how to set the width correctly but if I understand the listbox correctly a scrollbar mus appear at the bottom of the Listbox so that I can scroll Left and Right.

    I am including a print screen with the error as well as my code.

    This is a serious work in progress still.

    Re: SetFocus to an empty textbox control on a Multipage UserForm


    I got it to work now!!!

    I added the following line of code after the last End If

    If Not EverythingFilledIn Then Exit Sub

    It now changes the controls and labels as I want it to do.

    Last help on this part of the code now is:

    Once there are empty controls and you get to the last Tab and after jou Click the Save Button how do i get the focus to go back to the first TAB that has an empty control on

    Than again for your help.


    Re: SetFocus to an empty textbox control on a Multipage UserForm

    Hi Carim

    I take it you are talking about the Private Sub cmdSave_Click() event here.

    i am VERY new to this and do not understand the recommendation on what you suggest i do.

    Would you terribly mind to do and explain it in my code and send back to me. Just do the first textbox on Tab 2 txtDataSurname.

    Sorry for the inconvenience. i know it is Saturday afternoon/weekend .... :0ops::0ops::0ops:

    I am making a Multipage userform with 5 Tabs. I need to check that all controls on the userform is completed before it is safed.

    I have Text,Combo & Dates on the Tabs. I have managed to set defaults to the Combo and Date Controls by means of the Private Sub UserForm_Initialize() procedure.

    I am trying to loop through the userform to confirm that all controls are completed and once that is done to change the BackColor of the controls that is empty and to get the cursor to SetFocus on the FIRST control that is empty.

    Plse I need help with this.


    I am using the following code to populate textbox with uppercase which is working fine. The txtPersHPOBox field however has to take numbers as well as text.

    I need help with modifying the code to accept both.


    Re: Show and Hide of UserForm and Excel Worksheet with Toggle Button and Command Butt

    The users in the office will only use the Application. Not seeing the Excel Sheet at at all. once they have added the applicants i will then work with the WS. To make certian all validations has been done and that there are not duplicates etc.

    Idee will be to do aal this while they are using the Application but i am not there yet with writing VBA Code.

    As you saw in the workbook some of the stuff I have done but it will take to long to do all and then give them the Application.

    Currently they are typing it directly into a Excel worksheet and it is chaos.

    I will be coming back a lot to the forum as i carry on with this.

    Thanx again.

    I am currently having problems to Show and Hide UserForm and worksheet properly. When I open the workbook everything works fine. The Userorm opens and the Worksheet is hidden as I want it. When I click the Show Worksheet the worksheet appears. However when I click the Close UserForm the UserForm and Worksheet disappears completely!

    I am very new to VBA.

    Here is the code I am using: