Solved

Lostfocus Event \ Form Load Event

Posted on 2002-03-30
6
210 Views
Last Modified: 2010-05-02
I have a field where upon the Lostfocus event, an inquiry is made to a table. The problem comes when the user hits a function key that loads a different form.  The screen seems to flicker endlessly between the two forms.  The first form trying to execute the inquiry and the second form trying to load.  Help!
JIM
0
Comment
Question by:JZUPKUS
6 Comments
 
LVL 1

Expert Comment

by:COAtheGREAT
ID: 6907623
Show us code if you can.
0
 

Author Comment

by:JZUPKUS
ID: 6907636
Here's the lostfocus code:
Private Sub txtBILL_LostFocus()
    txtBILL.BackColor = lnBACKCOLOR_OFF
    Check_bill_number
    If blFOUND_RECORD = True Then
        If cboTRANSACTION.Text = "Adjustment" Then
            txtCITY_ASS.SetFocus
        ElseIf cboTRANSACTION.Text = "Misc Payment" Or cboTRANSACTION.Text = "Void Misc" Then
            txtFEES.SetFocus
        Else
            txtTAX.SetFocus
        End If
    End If
    check_transaction
End Sub



Here's the code that loads the "Form2":
Private Sub cmdINQ_ALL_BILLS_Click()
    'Inquiry on any bill
    inquiry_came_from = INQUIRY_FROM_INQUIRY
   
    Call Enable_Toolbar(False)
    Call Enable_Menu(False)
    Load inquiry
    inquiry.Show

End Sub


The lostfocus calls two other routines as well as setting the focus on other other fields.
0
 
LVL 1

Accepted Solution

by:
COAtheGREAT earned 100 total points
ID: 6907666
Nothing is here asyncronyous so it cant be that bouth sub are executing at the same time. I sepouse that LostFocus is first because cmd has reseved focus before click so search for error in form load event.
And if you do .Show you dont nead Load before.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6908434
In your code, try testing that the form is still active:  

For example, instead of:

  txtCITY_ASS.SetFocus

Try:
  If ActiveForm is me then
    txtCITY_ASS.SetFocus
  Endif

Actually, now I think of it, you could just change the line:

  If blFOUND_RECORD = True Then

To:

  If blFOUND_RECORD = True And ActiveForm is Me Then

If using ActiveForm gives you any trouble, try Screen.ActiveForm
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7754894
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to COAtheGreat
Please leave any comments here within the
next seven days.
0
 

Expert Comment

by:SpideyMod
ID: 7811896
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question