Rabu, 18 Mei 2011

RE: [MS_AccessPros] Gotocontrol not working

 

Connie-

When you select a value in the combo box list, the AfterUpdate event should
fire, and the focus should not move, so your code to move the focus should not
be necessary. Are you typing letters to find a value then hitting Tab to move
off the control and set the value? If that's the case, then AfterUpdate happens
first, then the Tab to the next field is honored.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of mrsgoudge
Sent: Wednesday, May 18, 2011 10:26 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Gotocontrol not working

John,

Two questions:
I pasted your code in and it's still setting focus on the next field.

Where would I find info about direct methods. I'm guessing your book? Guess
I'll have to bone up on it so that I recognize when there is a direct method.
My mind is having a hard time holding onto all this info :-(

Thanks again for all your help,
Connie

--- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@...> wrote:
>
> Connie-
>
> Never use DoCmd if there's a direct method. Use:
>
> Me.ListIDPropertyName.SetFocus
>
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of mrsgoudge
> Sent: Wednesday, May 18, 2011 8:08 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Gotocontrol not working
>
> A form's combobox (ListIDPropertyName) has code for the AfterUpdate event. The
> gotocontrol portion is not working. My goal is to have the cursor be in the
> control (ListIDPropertyName) that the code is behind.
>
> If I use DoCmd.GoToControl Screen.PreviousControl.Name the cursor is in the
> control before ListIDPropertyName.
>
> If I use DoCmd.GoToControl Screen.ActiveControl.Name the cursor ends up in the
> control after ListIDPropertyName. (the next control in tab order)
>
> If I use DoCmd.GoToControl "ListIDPropertyName" the cursor ends up in the
> control after ListIDPropertyName. (the next control in tab order)
>
> Here's the code:
> If DCount("ListID", "Listings", "PropertyName = '" &
> Me.ListIDPropertyName.Column(2) & "'") > 1 Then
> MsgBox "There are several properties with this name--click the arrow to
the
> right of the Property Name box to make sure you are selecting the correct one.
"
> DoCmd.GoToControl Screen.ActiveControl.Name
> End If
>
> Thanks for helping!
> Connie
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar