Getting lostfocus to fire./remote navigation 
Author Message
 Getting lostfocus to fire./remote navigation

I am having trouble programmatically moving to a specific record on a form
from another form.

Form 1: Customer records, single form format, keyed on intOrgID, an
autonumber field.
Form 2: Any of several forms.
From form 2, I want to jump to a specific record in form 1.
Form 2 accurately finds a valid intOrgID value I want to navigate to in Form
1.
Form 2 places the value in an unbound text box in Form 1.
Form 1 has an event tied to the unbound text box to position the record
based on its new value
(I use an afterupdate  and lostfocus event. The code is in both places with
a msgbox to tell me where it's executing. The msgbox is not impacted by an
error condition.)

If I interactively type a value into the unbound control, everything works
great. However, I get nowhere when using the following code from Form 2:

Code I'm using is:
'set unbound fintorgid to desired record#
Forms![frmOrg]![fintOrgID] = 1
'give form focus for the heck of it. This has no impact that I can see.
Forms![frmOrg].setfocus
'give focus to unbound control so it can lose focus
Forms![frmOrg]![fintorgid].setfocus
'set focus to ANY other control - can't!
Forms![frmOrg]![ftxtDepartment].setfocus

Result: When run from form 2, I get no errors, the unbound field is updated,
and the record does not change.
When run from the immediate pane, I get an error saying ftxtDepartment
cannot receive focus, but the record does reposition properly.
:
All controls are enabled, visible, and not locked.



Fri, 09 Aug 2002 03:00:00 GMT  
 Getting lostfocus to fire./remote navigation
I haven't tried to reproduce your problem, but I suspect that you are overly
concerned with the focus.  A standard method to do this type of thing is to
assign the desired value to form1's control and then call the lostfocus
event procedure explicitly.

Make the LostFocus procedure Public and use:

    Forms![frmOrg]![fintOrgID] = 1
    Forms![frmOrg]![fintOrgID].fintOrgID_LostFocus

HTH,
Marsh

Quote:

>I am having trouble programmatically moving to a specific record on a form
>from another form.

>Form 1: Customer records, single form format, keyed on intOrgID, an
>autonumber field.
>Form 2: Any of several forms.
>From form 2, I want to jump to a specific record in form 1.
>Form 2 accurately finds a valid intOrgID value I want to navigate to in
Form
>1.
>Form 2 places the value in an unbound text box in Form 1.
>Form 1 has an event tied to the unbound text box to position the record
>based on its new value
>(I use an afterupdate  and lostfocus event. The code is in both places with
>a msgbox to tell me where it's executing. The msgbox is not impacted by an
>error condition.)

>If I interactively type a value into the unbound control, everything works
>great. However, I get nowhere when using the following code from Form 2:

>Code I'm using is:
>'set unbound fintorgid to desired record#
>Forms![frmOrg]![fintOrgID] = 1
>'give form focus for the heck of it. This has no impact that I can see.
>Forms![frmOrg].setfocus
>'give focus to unbound control so it can lose focus
>Forms![frmOrg]![fintorgid].setfocus
>'set focus to ANY other control - can't!
>Forms![frmOrg]![ftxtDepartment].setfocus

>Result: When run from form 2, I get no errors, the unbound field is
updated,
>and the record does not change.
>When run from the immediate pane, I get an error saying ftxtDepartment
>cannot receive focus, but the record does reposition properly.
>:
>All controls are enabled, visible, and not locked.

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


Sat, 10 Aug 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. AfterUpdate and LostFocus Events do not fire

2. LostFocus Event Doesn't Fire for ActiveX TextBoxes

3. remote mail gets error ordinal 508 using remote mail

4. Getting event to fire on separate form

5. Event not getting fired.

6. Getting Retreat to fire

7. Getting the current date when the ChangeDate event fires

8. On-Exit macro for Checkbox Form field - getting it to fire upon Print or Save

9. On-Exit macro for Checkbox Form field - getting it to fire upon Print or Save

10. Getting Remote email


 
Powered by phpBB® Forum Software © phpBB Group