Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Lostfocus Event \ Form Load Event

Posted on 2002-03-30
6
Medium Priority
?
216 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 400 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Industry Leaders: 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!

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

604 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