Sorry I will try another forum. My workbook is too big and is not something I can share on a forum like this. Not sure why you would need the entire workbook to deal with the issue though.
Posts by tsohan
Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.
-
-
Here is a copy of the code I am using to populate my form from the listbox and to then get the two text boxes to show the scroll bars for the user. The one text box is off the screen so it causes the system to move down to that textbox and then return to the top of the userform. I am trying to find a way of stopping the screen movement without redesigning where all my textboxes appear. I have a multipage control I am also trying to sort out but if we can sort this one out it should be straighforward to deal with the multipage.
Code
Display MorePrivate Sub Reg_Database1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) 'whichever record is selected we capture the row number into the hidden Risk_Record_No_Textbox for lookup 'purposes later - by double clicking on a record in the listbox the form gets populated with this record Me.Risk_Record_No_TextBox.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 0) 'the column count starts at 0 Me.Reg_Name_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 2) Me.Reg_Short_Title_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 3) Me.Reg_Ref_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 4) Me.Reg_Date_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 5) Me.Reg_Last_Update_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 6) Me.Reg_Country_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 7) Me.Reg_Content_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 8) Me.Reg_DLR_Qty_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 9) Me.Reg_BC_Qty_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 10) Me.Reg_Overview_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 11) Me.Reg_Preamble_Extract_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 12) Me.Reg_Preamble_Ref_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 13) Me.Reg_Ind_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 14) Me.Reg_Sub_Ind_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 15) Me.Reg_Regulator_Textbox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 16) Me.Reg_File_Path_TextBox1.Value = Me.Reg_Database1.List(Me.Reg_Database1.ListIndex, 17) 'set the date format for all the date fields in the form Me.Reg_Date_Textbox1.Text = Format(Me.Reg_Date_Textbox1.Text, "dd-mmm-yyyy") Me.Reg_Last_Update_Textbox1.Text = Format(Me.Reg_Last_Update_Textbox1.Text, "dd-mmm-yyyy") 'now to get the scroll bars to show - this one is fine as it is in full view on the screen Me.Reg_Overview_Textbox1.SetFocus Me.Reg_Overview_Textbox1.SelStart = 0 'I find the screen jumps around now because the preamble textbox is not visible so this procedure pulls up the textbox 'and then sends me back to the Reg Name textbox at the top of the screen after making the scroll bar visible Me.Reg_Preamble_Extract_Textbox1.SetFocus Me.Reg_Preamble_Extract_Textbox1.SelStart = 0 'now move the focus to the top of the screen again Me.Reg_Name_Textbox1.SetFocus ScrollTop = 0 End Sub
-
I have a userform with a listbox at the top showing multiple records. Each record has many fields. These fields are grouped into 6 pages in a multipage control that the user can tab through to show the relevant fields for adding, updating, deleting what is in the listbox. By double clicking the record in the listbox the multipage control is populated and the user can then process the content.
I am looking for a way to set up all the fields in the various forms where a scrollbar exists at activation so that when the user goes into any of the pages to process the fields in the form it already shows the scroll bars applicable in the multipage control.
Currently I am using setfocus and curline to go through the textboxes but then I find the screen moves to each textbox to set the focus and show the scroll bar. I want the userform to stay showing the listbox and do this without the screen jumping around - is this possible?