Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make Insertion cursor go to start of field in an Access 2007 subform

Status
Not open for further replies.

johnfrani

Technical User
Oct 2, 2002
33
US
I have an Access 2007 app. I don't want the whole data field selected when a subform opens (too easy for the user to delete data). I have gone to Access Options / Advanced and set the cursor entering field behavior to: "go to start of field". This works for all of the forms in the app but NOT for subforms. In subforms, the WHOLE data field is selected when the subform opens. The subforms are datasheets.

How can I make the cursor go to the start of the first subform field?

Thanks, John
 
How are ya johnfrani . . .

Can you not select the same for subforms when you open them [blue]independently[/blue]! ...

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Going to Access Options / Advanced and setting the cursor entering field behavior to: "go to start of field" (I thought) was suppose to be a global setting to effect ALL data entry fields on forms and subforms in this database. In my app, it only works for primary forms, not subforms that are datasheets (look like spreadsheets). I know of no way to adjust this setting only for subforms. That is the help I am looking for.
Thanks, John
 
How are ya johnfrani . . .

What is the name of the subform in question and the control/field of interest?

What event are you currently using? ... Post your current code to perform this! I'm currently believeing something like:
Code:
[blue]   Me.[subformname].SetFocus
   [subformname]![ControlName].Setfocus
   Me![ControlName].SelStart = 0[/blue]

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thank you for your help. I have found a solution.

I have a form that has a Tab Control. On one of the Tabs, I have a subform that has been causing the problem above.
I found some code that causes the cursor to position itself at the start of the data in the first field of the subform.

In Design Mode, I selected the first data field. This was the one where ALL of the data in the field was selected.

Using the GotFocus event, I entered this code...

Private Sub Description_GotFocus()
Me!Description.SelStart = Me.Description.SelStart
End Sub

Now, when I select the Tab with the subform, the cursor behaves correctly, for my application.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top