AllExperts > Experts 
Search      

Visual Basic

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Visual Basic Answers
Question Library

Ask a question about Visual Basic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Ravindra
Expertise
visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel. Optional: 1)a large number of people want me to do work which takes some time and effort. Pl.note that i would like to be paid for such work. 2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time. 3) if you are pleased with my reply you could consider a donation of 1$. 4) you can visit my website http://ravindra.coolpage.biz (under constrn)

Experience

Past/Present clients
project work for a Norway company, and a Canadian company completed. Freelance Project work and Teaching
teaching vb

 
   

You are here:  Experts > Computing/Technology > Basic > Visual Basic > problem in LostFocus property of textbox

Topic: Visual Basic



Expert: Ravindra
Date: 6/15/2008
Subject: problem in LostFocus property of textbox

Question
Dear Sir,
First many many thanks for your previous valuable suggestion,
Sir here i am doing a validation with a text box that,There is a text box in the form.The validation i need that when i will add new data it will check from database if the data is exists then it show a message that the value is exist and prompt back to the textbox.
For this i wrote please check it...
--------------------------------------------
Private Sub vn_txt_LostFocus()

If rs.Fields("VesselName") = vn_txt.Text Then
MsgBox "VesselName Already exists Please Enter a Different VesselName", vbExclamation, "VesselName"
vn_txt.SetFocus
End If
End Sub
------------------------------------------------
in run time when i click any buttom like next ,previous... this message appears.while i am setting the textbox's tabstop property false then it works but not check the validation. my target is that while i will add new data to the text box then only it check the validation. please check the code and suggest me to solve the above problem.

Thanking u
Bipan


Answer
Private Sub Command1_Click()
rec.Open ("select  item  from testable"), conn, adOpenStatic, adLockReadOnly
Do While Not rec.EOF
If rec.Fields(0) = "erasers" Then
MsgBox ("Found")
Exit Sub
Else
rec.MoveNext
End If
Loop
MsgBox ("Not found")


End Sub

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.