Access Vertical Scrollbar focus on top of the form - ms-access

Any ideas on how to keep the scrollbar/focus on the top of a form?
I have continous form with many textboxes and listboxes that make the user scroll down the form no matter the resolution size of their screen. Ever since I implemented a Listbox with a rowsource query that will vary on the record, every time I change records the vertical scrollbar of the form will change focus to the bottom of the form.
I tried changing focus to controls on the top of the page or changing ways to change the rowsource of said listbox (using vba code like listbox.RowSource = theSQLQUERY or making the rowsource of the listbox with the sqlQuery). It used to work before I implemented that sourcecode, it had a sourcecode before and the problem never happened.
The rowsource query looks like this :
where active_flag = 0
My question is, How can I keep the vertical scrollbar/focus on the top of a form taking into account the listbox that changes rowsource?

The key is:
Ever since I implemented a Listbox with a rowsource query that will vary on the record, every time I change records the vertical scrollbar of the form will change focus to the bottom of the form.
Your code is iterating through every single record, from top to bottom. It goes to the bottom because that's where the code stops. That's fine, it's how Access works.
So, after that code, add the following:
Me.Recordset.MoveFirst
Or
DoCmd.GoToRecord acDataForm, Me.Name, acFirst

Related

MS-ACCESS Conditional Formatting while scrolling

I have a continuous subform (Data) within a single form (Main) where I use conditional formatting. The problem is, when I click the scroll bar to go down the list, the conditional formatting is removed until I un-click the scroll bar. Scrolling through the list with the mouse wheel works perfectly.
I suspect this is due to a refreshing or repainting of the formatting that is inherently triggered by a click?
I tried using Application.Echo False, and Me.Repaint = False, with no luck (although I am not even sure where I would need to put these).
Does anyone have any experience with this? Note, the data displayed via subform Data is static, meaning the user cannot update the fields within this particular subform (not sure if that simplifies anything).
On a continuous form, conditional formatting is only performed on records that are within view. As new records are scrolled into view, there is a brief delay while the conditional formatting is calculated. As records are scrolled out of view, their conditional formatting is discarded. You should find that scrolling with the mouse wheel does have a bit of a delay in the conditional formatting.
In some situations, one solution is to build the conditional formatting into the recordsource. For example, suppose negative values for Balance should be shown with a yellow background, and you would like to be able to scroll quickly through all the records looking for yellow ones.
I do this by adding another field to the recordsource:
IIf([Balance] < 0, String(30,ChrW(9608)), "") AS BalanceBG
and then binding this to a TextBox with text color of yellow and font of Courier.
The 9608 character is a solid block, and a string of them fit tightly together to make a solid bar.
With this TextBox positioned behind the TextBox for [Balance], the yellow background will show even as the scrollbar thumb is dragged up and down.

MS Access subform resizing

I have 2 forms; a parent form (frmResults) and a sub form located within the parent form (frmResultsSub). The sub displays the search results from a query, and will have horizontal and vertical scrollbars depending on the number of fields and records returned.
To give the user a better viewing experience of the results subform, I have been playing about with tyring to implement a method to automatically resize the subform (increasing the number of fields and records displayed) as the user drags in/out the parent form, and allowing them access to the sub's scrollbars at all times.
On the parent's Resize event I have the following...
Me.Section(0).Height = Me.InsideHeight
Me.frmResultsSub.Width = Me.WindowWidth - 700
If Me.WindowHeight > 2650 Then
Me.frmResultsSub.Height = Me.WindowHeight - 1850
End If
I have the parent form's scrollbars switched off - the only scrollbars present are those of the subform, and I have additional space at the parent top for extra info and a couple of cmd buttons.
To an extent, this works well...through trial and error (with 2 of the 3 numeric values above) there is a small border around the subform.
Problem:
I've had to place a minimal subform height of 2650 since Access will error out otherwise.
However, if the parent form is dragged too large Access still errors with a "Run-time error '2100' the control or subform is too large for this location"
Instead of adding more minimum and maximum subform values (if that would work), is there a better way to implement a subform resize, preferably also allowing for the parent form's min/max buttons to work. I have a few additional forms that would benefit with similar resizing.
Thanks for any help.
[Access 2003 compliance required]
Edit: I've added Me.Section(0).Height = Me.InsideHeight to try to adjust for the form's Detail section, but Access still throws the same error (I don't see a .Width equivalent for the Detail section)
Edit2: this problem seems identical to that seen at http://www.pcreview.co.uk/threads/maximum-width-if-a-subform-in-access-2k.2601154/ unfortunately, no answer was provided.
I've changed to using Me.InsideWidth / InsideHeight but still have Access error out when the subform tries to get wider that around 31560. Interestingly, Me.Width will only grow to about 31560 before it changes to a negative value...Me.InsideWidth continues to grow as a positive number as the window stretches wider. By only having a .Width property for the subform I wonder if this is the issue (the subform will change to a negative value at the same point, throwing the resize off)

Is there a programatic way to deal with subform / scrollbar situations in MS Access?

SHORT DESCRIPTION: I need to see all the columns in a datasheet subform. Specifically - 12 columns of months. To do that, I need a horizontal scroll bar. To get to that scroll bar is a challenge. I am developing in MS Access 2007.
THOROUGH DESCRIPTION:
I have a subform 'frm_SP' which displays in datasheet view that is 22" wide which is limit in width for a form - it is nested in another subform called 'frm_stage'.
I finally discovered that no matter how wide I make the very top "Parent form - 'frm_Entry' I can't seem to make ALL of this 3rd nested subform 'frm_SP' visible. The horizontal bar at the bottom just seems to compensate by proportionately growing to keep the limitation intact - this is frustrating.
As you can see in this image below, I have to scroll down to see the horizontal scroll bar. Why is it so far down? Did I specify that somewhere? It keeps that distance no matter how many records exist in the datasheet. So if it only had 4 records, I'd still have to scroll all the way down to see the scroll bar.
Similarly, I have a set of records that go beyond the horizontal scroll bar and I have no way of making the window large enough to see those records. So I have had to tell the client to open the actual table if they need to edit those records.
I have hesitated to post anything like this because it requires images, but now that I have done the work, hopefully this can solve a lot of issues for other users. Maybe this is the reason that there aren't many answers on the web that I can find.
Any tips, suggestions for alternate methods are welcome.
I added "SendKeys" code for the arrow keys so that that the 12 boxes would function more like a spreadsheet.
But I don't understand why January is skipped and then it continues to skip every 2 boxes
Here is the code:
Private Sub txtDEC_NC_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 40 'down
SendKeys "{TAB}", False
Case 38 'up
SendKeys "+{TAB}", False
End Select
End Sub
If you haven't already, try increasing the size of your 2nd-level form (as well as the subform control on that 2nd-level, which houses the bottom level form).
It looks like your bottom level form (with a max width of 22") requires a horizontal scroll bar in order to display within your 2nd-level form. This causes the scroll bar to appear within your 2nd-level form (where you have to scroll-- within the top form-- down in order to see it).
Instead, you probably would prefer that scroll bar to appear on your top-level form, which I believe you will get if your 2nd-level form (and the subform control for your bottom-level form) are also set to a max-width of 22".
The bottom level form will then display within the middle form without the need for a middle-form scroll bar, and the one (and only) scroll bar will render on the top form, where it will always be easily accessible without the need to scroll down first.
I have some thoughts on what causes the extra vertical white space in your second form, but I wonder if the above might not solve your problem.
Just a thought. (And I realize that this is a very old question, so perhaps you no longer need any suggestions here--in that case, I'll just leave this comment for others who may have a similar issue in the future).

MS Access scrollbar on subform continuous forms not setting record focus

I can't seem to figure this out. I have a subform displaying continuous forms with a vertical scrollbar. When I click the scrollbar to move to a different record, the record never receives focus. The focus is still on the control of the record I left.
How to I control the record focus after using the scrollbar? The subform's On Current event does not fire.
Thanks!
The vertical scroll bar in a continuous MS Access form does not navigate among records. It simply changes which records are visible on the form. The black triangle within the record selector on the left side of the form indicates which record is currently "selected."
You can navigate records (ie, control the record focus, as you say) several different ways:
Click on the record selector* (the gray rectangle to the left of the form detail section)
Click on any enabled control within the form detail section
Use the navigation controls* at the bottom left of the form
Use [Tab], [Enter], or arrow keys to move through the individual controls on the form detail section; when you reach the last control in the tab order, your next [Tab]/[Enter]/[Down Arrow] key press will take you to the next record
* Note that both the Record Selectors and Navigation Buttons may be turned off on your form. On the form property sheet, ensure Record Selectors: Yes and Navigation Buttons: Yes.

ms access 2003 - Text boxes on a form: not jumping to any text box

Ok so I add all these text boxes on an unbound form, and everytime you open a form, it sort of jumps to the first text box so you can enter some information into it.
How do I get rid of that, because I do not want it to auto jump to the first text box when the form opens...i do not want it to jump to any text box when the form open at all.
thanks
You will have to decide where you do want it to go, because it has to go somewhere. You can control where will tab order, set focus, and autotab.
I have just checked, and the best thing to do is to set the textboxes Enabled property to No and the Locked property to Yes.
The default behavior is of course for the cursor to move into the first control that you’ve set up in the tab order.
Assuming you still want some sensible tab order in the form, then place a zero length text box in the forms headder. Remove the tab stop setting (other tab in property sheet). You might as well set this box transparent also.
Then in the forms on-load event, simply go:
Me.NameOfTextBoxinFormsHedaing.SetFocus
If I read your question correctly it seems that you do not want any of your textboxes on the form to have the focus on opening the form.
What you need to do in this instance is to create a new unbound textbox on your form, and then make this unbound the first item in the form's tab order. Then resize the unbound textbox to 0 height and 0 width, making it invisible.