Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Set focus problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RipperT - 05 Apr 2005 02:53 GMT
Hello,
I have a combo box that users can use to look up a field value in the
database. If the value is not found, a message box appears saying as much
with an OK button. When the user clicks OK, either with the mouse or the
Enter key, I would like the focus on the same combo box with the previously
typed value highlighted, ready for the next entry. I am using:

       Forms!myForm!Combo206.SetFocus

which sets the focus, but the text is not highlighted; the cursor is at the
beginning of the field. Is there a way to get the field highlighted?

Many thanx,

Rip

Signature

Ripper T Smith
rippertsmith<nospam>@comcast.net

MWG - 05 Apr 2005 04:03 GMT
Try the following:
with cbobox
 .selstart=0
 .sellength=len(cbobox)
end with

Hope this helps!

> Hello,
> I have a combo box that users can use to look up a field value in the
[quoted text clipped - 11 lines]
>
> Rip
RipperT - 05 Apr 2005 04:26 GMT
It's not working. Am I using it correctly?

Private Sub Combo206_AfterUpdate()
   ' Find the record that matches the control.
   Dim rs As Object

   Set rs = Me.Recordset.Clone
   rs.FindFirst "[InmateId] = '" & Me![Combo206] & "'"
   If rs.NoMatch Then
       MsgBox "The inmate number you entered is not in the database."
   Else
       Me.Bookmark = rs.Bookmark
   End If
   Forms!frmInmates!Combo206.SetFocus
With Combo206
 .SelStart = 0
 .SelLength = Len(Combo206)
End With
End Sub

Many thanx,

Ripper

Signature

Ripper T Smith
rippertsmith<nospam>@comcast.net

> Try the following:
> with cbobox
[quoted text clipped - 21 lines]
>>
>> Rip
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.