var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Subforrm - Removing Highlighted Record OnOpen
This is a problem that has been plaguing me for months. Tonight I thought I had it. It worked in AccessXP fine until I compacted the database, then the same old problem.
I have a main form with a subform set to Continuous Forms. It is populated by a query but is not related to the main form.
When the main form is opened, the record selected in the subform is highlighted. I want it not to be highlighted but have the cursor blinking on the left side of the text.
From the google newsgroups I found some code that worked at first, but as noted above, could not withstand the compaction/repair. I got no errors, it just stopped working!
Here is the code at the end of the OnOpen event of the form. I also tried it in the OnCurrent and in both but to no avail.
I am simply blown away that this could work for a while and then abjectly, totally fail. Any advice will be most appreciated.
Being entirely honest, i have only used this in Excel VBA but it should work!
Forms![Name of form]![name of textbox].Selstart =0
Yes, thats right! I got the same response in the UK World Access and UtterAccess forums. My code block looks like this:
Forms![frmEnter_Tasks]![subfrmEnter_Tasks]![txtTaskName].SelStart = 0
The other response was:
Using "On Got Focus" for the field in question, try:
Me.TextBoxName.SelStart = 0
To select the end of the field you can use:
Me.TextBoxName.SelStart = Me.TextBoxName.SelLength
Note: If you want this feature for all fields, You can set this as a default option in Tools / Options / Keyboard
Hope I am on the right track. Brad.
The above may be more useful for me as I requery the subform with several controls on the Main form. Thanks for your reply!