Setting Focus on a subform object and using .SelStart

G

Guest

I am having trouble trying to get the correct syntax to set my focus on an
object in a subform and setting the .SelStart control.

In the subform I have a button, which does the same job:
Me.Comments = vbCrLf & Format(Date, "mm/dd") & " - " & Me.Comments
Me.Comments.SetFocus
Me.Comments.SelStart = 10

But when I try to execute the same action from the code in the main form I
either get nothing or errors:
Select Case Status
Case "New", "Researching", "Pay Taxes"
' Various Cases with no action.
Me.Refresh
Case "Left Message"
Loan_Comments.Form![Comments] = vbCrLf & Format(Date, "mm/dd") &
" - Left Msg @ " & Format(Now, "hh:mm") & ": " & Loan_Comments.Form![Comments]
Forms!Loan_Comments!Comments.SetFocus
Comments.SelStart = 26
Me.Refresh
..
..
..
Case Else
MsgBox "Status not recognized." + vbCrLf + "No Action Taken"
End Select

When I make a status change in the main form, how do I change focus to the
comment field in the subform and set the .SelStart control?

It has been a long time since I coded in vb and would appreciate any
assistance.

Thank you,

Richard..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top