I have a question. Is it true that in Access 2010 we can read which item in a list box has Focus. By focus I mean that little rectangle that is around current item. This is not a selected item. Selected item is highlighted. By clicking on List Box we set focus on an item and also select it. When selection is changed the focus stays there.
The property that indicates the index of that item is I believe .ListIndex. I would like to programmatically change it but unfortunately .ListIndex is read-only in Access 2010. Is there any other way I can do it?
Thanks
Related
How do I retrieve the current value from any column of a current active control List box.
The list box has data with 3 fields.
I would like the the value of that 3rd column value to be displayed on a textbox when a user clicks a button.
txtBox = [Screen].ActiveControl.column(3)
I can't figure out what I'm doing wrong.
.Column is zero-based.
Use .Column(2) to get the value of the 3rd column.
But: if you do this on a button click, the button is the active control, not the list box.
So the only way to do this (except by addressing the list box by name instead of ActiveControl) is in the list box AfterUpdate event.
(Though in this case you don't need ActiveControl either...)
I'm trying to add an OR feature in the Continuous Filter Form and as you can see the first combobox shows up which I don't want it to show. Ideally, it should show only when the user wants the second row search option not in the first row filter. I have only OR in the combobox. Thanks for your help and let me know if you need any clarification!
Continuous form controls are all or nothing. If it's visible, it's visible in all rows, if invisible, it's invisible in all rows. There's nothing you can do about that.
You have four options (in order of complexity):
First Option:
The "On Current" event of the form happens when a user moves from one row to another inside the continuous form. you can add an IF statement to that event that disables the first box if the user has moved to the first row.
Second Option:
Have a fixed amount of filter boxes, and don't let the user pass the limit
Third Option:
Have a fixed amount of filter boxes, but make a "forward" and "back" buttons that will change what data the filter boxes link to, effectively making a 'custom' continuous form
Fourth Option:
Dynamically create the textboxes programatically (not recommended)
Set the default 'Visible' property to 'No' and then Reset it to 'Yes' when a second criteria is selected. This will populate the whole column though, just so you know.
I have a form containing multiple TreeView ActiveX controls with check boxes. Depending on the selected item in the first TreeView, I show different items in the other TreeViews.
I want to disable all the TreeViews if an uncheked item is selected in the first TreeView. To do so I check if the SelectedItem is checked in my update function. If not I set the Enabled property to false for all the TreeView except the first and exit. If it is checked I set the property back to true and update the TreeViews depending on the SelectedItem of the first TreeView.
It is working but my probleme is that when I set the Enabled property back to true, after it has been set to false, the TreeView is displayed in the top left corner. They stack in the corner so only the last one can be viewed.
I've search for a hint on how to fix this but had no luck. Any idea?
For future searchers:
I also had an issue with a TreeView jumping to the top left. In my case, I had a sub-report that was updated as well, and everything was fine until I clicked on the TreeView. Once I did, the view jumped to the top left.
Here's what I did to fix it:
Private Sub MyTree_GotFocus()
Me.MyTree.Top = Me.MyTree.Top
Me.MyTree.Left = Me.MyTree.Left
End Sub
Even though it just set the properties equal to their current values, updating the values re-anchored the element.
You could most likely just add those lines after whatever triggers the jump.
Me.MyTree.Enabled = True
Me.MyTree.Top = Me.MyTree.Top
Me.MyTree.Left = Me.MyTree.Left
I had a similar problem, the tree view would move when I switched from one tab to another. The only way I could get it to stop doing that was to put the TreeView control in its own sub-form (nothing in it but the TreeView control, and place that sub-form on the main form.
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.
I have a textBox and I am using it as a mail address input field where the user can type in several addresses, a bit same as in hotmail. Each address is rendered into a clickable button. Thus upon double-clicking on a specific address I want the item to be editable. After having edited the address when the user taps enter, the item is added to the list of mail adds.
I am adding it using the code below:
flowBox.addChildAt( myItem, myindex);
However addChildAt seems to add the item as the last item in the list. But I want it to add the item the position where it was originally. Say the item was at position 2 in the mail list, after editing adn tapping enter, it should add at position 2 itself and not at the end of the list.
Can you please tell me if there is any way for doing this?
Thanks
Try to use addElementAt() instead. More details are here.
You can do what Constantiner has suggested, perhaps it's addChildAt(index).
The other way of doing is just hide the child and show the child instead by visible property instead of removing and adding