Solved

Lostfocus Event \ Form Load Event

Posted on 2002-03-30
6
204 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
Comment Utility
Show us code if you can.
0
 

Author Comment

by:JZUPKUS
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 6

Expert Comment

by:anthony_glenwright
Comment Utility
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
Comment Utility
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
Comment Utility
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now