Modules & VBA :: Controlling Scroll Bar Position
Jul 5, 2013
So I've got a form:
- A set of unbound controls filters (using a dynamically-built WHERE statement) a subform in datatable view.
- A set of bound controls displays the currently selected subform record; the two reflect one another.
- A set of unbound checkboxes at the bottom allows the user to change which fields are displayed in the subform.
Turns out, all of this makes for a pretty big form. Some of the users have screens that will not fit the full form due to resolution settings, physical size, aspect ratio, etc. Whatever the reason, the result is one or both scrollbars appearing on the form.
The issue is this: Whenever the filter controls are changed, the form's Current event runs (because the After Update events for the filter controls all change the main form and subform's Recordsource). But the Current event causes the form to requery (or refresh?), meaning the focus returns to the control with Tab Index 1 (a "Home" button near the top of the form).
Thus, the form tends to "jump around" a lot when users are determining the records they want displayed.Is there a way to avoid this?
- Can I prevent the "Home" button from getting the focus during those times?
- Alternatively, can I set the position of the scroll bars so the user doesn't see that jumping around every time a control is updated? I found some interesting ideas that worked for continuous forms, but mine is a single form, so bookmarking methods won't solve my issue.
View Replies
ADVERTISEMENT
Oct 20, 2004
I have been trying to make forms open scrolled to the top and have had very little success.
I found a function on the following site http://www.lebans.com/SelectRow.htm that works great as demonstrated and when I attach the following code to a text box the form scrolls to the top.
Private Sub Text98_Click()
Dim lngret As Long
lngret = fSetScrollBarPos(Me, 1)
DoEvents
End Sub
What I am trying to do is have the form scroll when it opens but by attaching the above code to the form's on_open event there is no effect.
What am I doing wrong.
Any ideas
View 5 Replies
View Related
Jul 6, 2006
Hi again!
This time I'm having some problems finding a way to determine the output of a scroll-down menu (or in my danish version of Access called "combination-box").
In the menu I can choose between a number of names from a table. But when I select the name and press the "OK" button that stores the data, only a number (and not the choosen name) is written in the table. How can I get the output-value of the drop-down to be the choosen name???
Please give me a simple answer and a simple solution... I'm a total newbie!!
// JR
PS. Mike, feel free to reply... I kinda like your style:-)
View 2 Replies
View Related
May 22, 2013
I have a form that i have created with various tabs along the top, e.g. customer details, customer contact etc etc.I have a subform on one of the tabs.
That subform also has tabs on it.When clicking on the main form tab it goes to subform but the scroll bar moves down only to show the subform tab options. I have to keep scrolling back up to see the main form tab options.
View 7 Replies
View Related
Jan 9, 2015
I have a form in datasheet view, with the record ID column frozen and users typically scroll to the right to see certain columns. Different users scroll to a different position.
I dont have the option to reduce the number of columns or create separate forms for different users, - they all need to see all the columns but typically a user scrolls horizontally to see a certain set of columns most of the time. I want to save that position for the next time they open the form.
View 2 Replies
View Related
Sep 15, 2004
Is there a way to change the vertical scroll bar position to always be at the top when I move from form to form. Right now, it will start at the top, but when I move to a different form and back, the vertical scroll bar is positioned in the center. I turned off the autocenter property of the form and saved it in the desired position, but that doesn't work. My form is maximized when it opens. I would greatly appreciate some help. This has been an annoyance for quite some time now.
View 1 Replies
View Related
Jul 20, 2015
I have spent the better half of the afternoon researching how to accomplish controlling a bold font in a string I am building and sending to Excel.
Code:
' set text for safety hazards and controls
Concretetxt = "Concrete Demolition & vbCrLf & Hazards - dust, flying debris and skin Irritation. & vbCrLf & Control - Respirator, goggles, gloves, inspect equipment prior to use."
Excavationtxt = "Excavations & vbCrLf & Hazards - Damage to underground wires, collapse, falling materials/equipment. & vbCrLf & Control - Ensure utilities have been marked and hand dig when in close proximity, shore properly, Keep clear when lowering materials."
This is a sample of how the strings will build. I will select a task like Concrete Demolition and string it together with other tasks I would like "Concrete Demolition" in bold with the blurb following it then the next task would follow with a bold heading.
My thought is now that it may be easier to control by putting this data into a table instead of building the strings.
View 2 Replies
View Related
Oct 10, 2014
I am trying to figure out how to control a navigation tab with a checkbox. I have a database for my fire dept and the check box is called "deceased". When a member passes away, the active box gets unchecked and deceased gets checked. Under the member subform, there is a tab, navigationbutton19, that is called deceased also and under this tab all their burial information is stored. What I am trying to do is, if the checkbox is not checked, I want the tab to be enabled = false.
View 1 Replies
View Related
Dec 2, 2013
I have a Form to Display Projects that has a SubForm displaying Sub-Projects related to them. The main Project Form has a Combo Box which allows a user to select a ProjectID to display. The SubForm has a ProjectID Field as well. When the Project ID is selected in the Main Form, only the appropriate Sub-Projects are displayed in the Sub-Form.
On the SubForm, there is a Field named ActionID, which uses the following VB Code to limit the availability of the Fields in the SubForm that apply to Dates. If the selected Action is Install, only Install related Dates should be available. Likewise, if the selected Action is Remove only Remove related Dates should be available.
Code:
If Me.ActionID.Column(1) = "Install" Then
Me.AssetInstallMonth.Enabled = True
Me.AssetInstallYear.Enabled = True
Me.AssetRemovalYear.Enabled = False
Me.AssetInstallMonth.Locked = False
[Code] ....
Everything seems to work as expected until there is more than one Sub-Project is the SubForm and they do not contain the same Action. In these cases, it appears as if the Sub-Projects in the SubForm are not being treated as individual records. If Sub-Project is Added or Modified to have an action of "Install", all records are treated as Install Records (only Install related Dates are available), regardless of their content.
Is there a way to update the properties for only the row that has been selected?
View 5 Replies
View Related
Feb 8, 2014
I have below code for maximum 3 criteria dynamic search:
Code:
Private Sub SearchFor_Change()
Dim strWhere As String
Dim Criteria As String
Dim i As Integer
Dim A
Dim strAdd As String
[code]...
There is a problem, since I put the code in a textbox's on change event. then in case i want to revise the first two criteria, the cursor will automatically fleets to the end of the text, I want to know how to keep the position of the cursor?
View 4 Replies
View Related
Jun 19, 2013
I have some graphs on a report that I need to dynamically position. The user selects which graphs he wants to put in and then the reports repositions the graphs based on input.
I've been using the following code to move the graph:
reports!rpoly.gGPCMWbyDRI.top = 3.625
which compiles, but moves the chart to the "0" position. I tried using a string ("3.625"""), or a stint ("3.625") but neither worked.
View 2 Replies
View Related
Apr 25, 2013
I have a form and in the form is a subform. When I add a record with the following code, the subform detail scrolls in such a way that you can't see the record you just added...only a single blank new record. Can you set the scroll position so that I can see all the previous records including the one I just added?
Private Sub Add_PROJ_RECORD()
On Error GoTo Err_Add_Click
Me.PROJECT_DATA.Locked = False
Me!PROJECT_DATA.SetFocus
DoCmd.GoToRecord , , acNewRec
Me.PROJECT_DATA.Form.PROJ = PROJ_COMBO
Me.PROJECT_DATA.Form.SPEC = SPEC_COMBO
Exit Sub
View 2 Replies
View Related
Jul 22, 2015
I recently found a neat little module which allows you to duplicate a right click & bring up pop up menu ( say by left clicking on a field). I find this very good for creating a nice little menu system in which I can reproduce the nice features of Access menus (I'm using Access 2002) but with a lot more flexibility.
So, I have a line of labels across the top of the form which are my top level menu items - when I click or mouse over these I want to have the pop up menu appear directly under the label. I can position the pop up menu manually by SetCursorPos(x,Y) but as my forms are Pop Up and can move this has proved to be a pain.
What I am after is something that will allow me to work out the coordinates of the left bottom of the label and then position the cursor there then drop the menu. The difficulty I'm having is converting or understanding the position of the label (me.label1.left etc) and relating that to what SetCursorPos needs.
View 4 Replies
View Related
Nov 27, 2013
I am working with two forms frmManager and frmMMeasures where based on selection from the combo box of frmManager of the department, position and staff member frmMMeasures is loaded where MUserLoginID and MPositionName is populated based on selection from frmManager. This is what I use to populate the MUserLoginID field for the control source " =[Forms]![frmManagers]![cboStaff] ".
My problem is when I go to the next record on the form those two fields do not change from what was picked up from the form frmManager.
I don't know how to ensure that the correct data is displayed.
View 1 Replies
View Related
Apr 23, 2014
I'm using the following code to clear selected records from a listbox after a button is pressed:
Code:
For i = 0 To lstProducts.ListCount - 1
lstProducts.Selected(i) = False
Next
The code works great except that it leaves the listbox scrolled all the way to the bottom. What is the best way to scroll back up to the top of the listbox without selecting another record?
View 3 Replies
View Related
May 24, 2015
I have a textbox on continues form which contains multiple lines and I d like to set it up so it ll be scrolled down completely when it displays the form. I ve already found a few so called solutions but nothing worked for me.
View 5 Replies
View Related
Jan 29, 2014
I have a listbox which is populated by a query from a table.
I also have a sub which allows users to quickly select multiple items from the listbox (based on a pre-defined criteria) rather than scrolling through and selecting them manually / individually
The sub works fine but when it is finished, the listbox is automatically scrolled to the bottom (or, rather, to the last selected item)
I would like to have the listbox scroll back to the very top once all of the appropriate items have been selected.
(I could loop through the listbox items in reverse - or 'bottom-up' - in the code but that would only have the desired effect if the topmost item was selected. I want it scrolled to the top regardless of whether the topmost item is selected or not).
View 2 Replies
View Related
Jan 17, 2007
I have a form. In it is a status field that can be:
NEW
SENT
CREDIT
COLLECT
CLOSED
When the item is created, it is given a "NEW" Status. And there is a command button on the form that can change the status to "SENT". However, based on external factors (email received or system report examined) the user can manually change the status to the CREDIT, COLLECT or CLOSED. Now, I want to make sure that then can't change the status manually to "SENT", only the system is allowed to do that via the command button.
How can I allow them to use some of the allowed values, but not others?
David
View 1 Replies
View Related
Jun 16, 2005
Hello All,
How would I run a procedure in DB2 from DB1?
View 3 Replies
View Related
Jan 5, 2007
Hello,
Dont understand what is controlling these decimals. I dont need any decimals for this database. The currency is talking bout money in 1000's and the probability is whole numbers.
Here is where I cant get the decimals to stop:
http://img80.imageshack.us/img80/3685/untitled2pl2.png
http://img77.imageshack.us/img77/6276/untitled3pa6.png
http://img208.imageshack.us/img208/2047/untitled3lk8.png
I have tried different things but no luck...anyone have any suggestions.
Thanks.
View 10 Replies
View Related
Jan 12, 2007
In a simple access table, I have the follwiing:
Data type: Date/Time
Format: mm/yyyy
Input Mask: 99/99
It restricts me to enter 2006 for instance. It converts to 2007. I want to be able to enter any year. Please help. Thank you.
View 2 Replies
View Related
Jun 29, 2005
Is it possible to control the data of a subform by making selection in a combo box?
View 2 Replies
View Related
Dec 10, 2006
Howdie y'all
I need a few pointers wrt the relationship between a form and its subform.
I have the following form:
http://i88.photobucket.com/albums/k193/bernmc/Misc/DefaultStaffingscreenshot.jpg
Top part of the form is for adding/editing etc.
The subform is based on a query. The two are linked on the 'week' value.
Now, this is what I want to do:
The user must not be able to edit data in the subform (so should I use a report instead... but then will I be able to do 2...).
Selecting a row in the subform should cause the whole form to go to that record so that the user can then modify info in the fields of the main form.
I don't know VB - the only code I've used is gleened from searching these forums (a great resource, so I'm learning slowly), so I'll need a bit more than 'Do a wrzmitchigob on the bleedlethrop'!
View 10 Replies
View Related
Mar 27, 2008
My report has the Section's Footer.
Each time the section runs, it will take up a different amount of space.
I have already run all the code, to move all the different controls to the top (and be invisible) when they are not needed.
So to the best of my knowledge, I have no controls sitting in the lower part of the section.
The last thing I run is:
Code: Me.S123.Height = Me.S123.Height - 300
s123 is the name of the Footer SEctions. The idea is that it gets progressively smaller.
This is all running in:
Code:Private Sub S123_Format(Cancel As Integer, FormatCount As Integer)
All the other things work.
Here is a sample of it all..
Code:If Me.txt2 = 0 Then Me.a2.Visible = False Me.b2.Visible = False Me.a2.Top = 0 Me.b2.Top = 0 Me.box.Height = Me.box.Height - 300 Me.S123.Height = Me.S123.Height - 300End IfIf Me.txt2 <> 0 Then Me.a2.Visible = True Me.b2.Visible = TrueEnd IfIf Me.txt3 = 0 Then Me.a3.Visible = False Me.b3.Visible = False Me.a3.Top = 0 Me.b3.Top = 0 Me.box.Height = Me.box.Height - 300 Me.S123.Height = Me.S123.Height - 300End If
This runs through 8 different numbers.
as I said, all the other things operate properly. They get hidden and move.
Any thoughts?
Thanks.
View 3 Replies
View Related
Feb 6, 2006
Hi there,
Is it possible to control a lighting system from Access using a combination of VBA code or Active X add ons with some specialist hardware and cabling attached to the PC, etc ?
To be more specific, I've designed a Snooker Hall Management program and want to be able to turn the lights on over the Snooker table when you start a game in an Access form...My application has 8 tables but could be expanded obviously.
I'm happy with the Access side of things (first attempt at a real world solution, etc) but to be totally polished a hardware interface to control the lights would really create a 'wow' factor...
Any help or direction would be greatly appreciated :)
Regards
dazza61
View 4 Replies
View Related
Apr 21, 2005
Hi,
I'm v.new to Access so do excuse my ignorance.
I have a form with a combo-box with the following values:
Trust, Course, Overseas, GP
When Trusts is selected I'ld like frmtrust_sub to appear.
When anything else is selected I'ld like frmnontrust_sub to appear
Once the data has been entered in the subform the user would continue back to the main form.
I'ld like the subforms to remain hidden until needed, if possible so as not to confuse users.
I’ve copied this piece of code and have tried pasting it into the “after update” event procedure but I get this error message
“the link masterfields property section has produced this error “Ambiguous name detected: Type_afterupdate”
Private Sub Type_AfterUpdate()
Option Compare Database
Sub ShowSubform()
'Save unsaved changes to currently open subform
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'Display appropriate subform based on Type chosen
If Type = "Trust" Then
frmtrust_sub.Visible = True
frmnontrust_sub.Visible = False
ElseIf Type = "GP" Then
frmnontrust_sub.Visible = True
frmtrust_sub.Visible = False
ElseIf Type = "Course" Then
frmnontrust_sub.Visible = True
frmtrust_sub.Visible = False
ElseIf Type = "Overseas" Then
frmnontrust_sub.Visible = True
frmtrust_sub.Visible = False
ElseIf Type = "Other" Then
frmnontrust_sub.Visible = True
frmtrust_sub.Visible = False
End If
End Sub
Private Sub cmdClose_Click()
'Close form
DoCmd.Close
End Sub
Private Sub Form_Current()
'Call subroutine to display appropriate subform based on template type
ShowSubform
End Sub
Private Sub Type_AfterUpdate()
'Call subroutine to display appropriate subform based on template type
ShowSubform
End Sub
Any help would be greatly appreciated
thanks
Barry
View 1 Replies
View Related