Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP!!!!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Anyone please help me to write a program in Visual Basic 6 to read a database in text file (.txt) and then compare with the input value in text box to see if this value are already placed in database or not????

 
why not do a search on the Db instead. way quicker and easier to boot.

just hit the Db and try to select the item
if the number of rows returned by the query is zero then
insert
else
write item already in Db
end if

hth Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Hi Steven82au,

first of all, open the file:
Code:
Open "C:\myfile.txt" for input as #1

second: put the input value on a variable (or not, you don't need this)
Code:
valor=textbox1.text
dim sim as boolean 
sim =false


third: search the file for the value
Code:
WHILE NOT Eof(1)
LINE INPUT #1, temp$
if (temp$==valor) then
sim=true
WEND

now, if the boolean "sim" is false, you dont't have that value in the file, otherwise, it's there alright.

last but not least close the file:
Code:
Close #1
===================
* Marta Oliveira *
===================
marta100@aeiou.pt
-------------------
CPC_TA- Braga
-------------------
Portugal
===================
 
Hi all!
I'd like to thank all of you so much!! I've already done the program sucessfully with your helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top