Solved

Keep Focus On the Specific TextBox

Posted on 2008-06-11
3
166 Views
Last Modified: 2010-04-30
When the user fill the Textbox I want to check his information with the data base if is found I want to tell him Record found before then cancel the lostfocus . Where I can apply this code and how to to that
0
Comment
Question by:Ahmadal_najjar2003
3 Comments
 
LVL 16

Accepted Solution

by:
robinu earned 250 total points
ID: 21766478
In VB6, you can use the Textbox' Validate event.

e.g.:
The function CheckedInDatabase() should check the information in the database, and return True when ok,
and False when not ok.
Private Sub Text1_Validate(Cancel As Boolean)

    'check in database    

    If Not CheckedInDatabase(Text1.Text) Then

        Call MsgBox("Sorry, not found in database")

        Cancel = True

    End If

End Sub

Open in new window

0
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 250 total points
ID: 21767610
Be sure to set the CausesValidation to False on your Cancel or Exit button otherwise the user won't be even able to close the form.
0
 

Author Closing Comment

by:Ahmadal_najjar2003
ID: 31466436
Thanks A lot
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

760 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

18 Experts available now in Live!

Get 1:1 Help Now