Solved

Lostfocus Event \ Form Load Event

Posted on 2002-03-30
6
209 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Title # Comments Views Activity
Access 2013 combo box not working 3 51
vb6 connector to SQL Server 2 37
Hide vba in gp 7 104
How to hault or freeze parent form when a 2d form is open in vb6 3 40
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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

828 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