Solved

Lostfocus Event \ Form Load Event

Posted on 2002-03-30
6
211 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 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

732 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