473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VB import text file for comparison

risk32
98
Hello. I'm trying to open a file for comparison to two (2) input box text values. ie:
txtPassword.text + ";" + txtUsername.text must equal whats in a line in the UNPW (username password) text file locally saved.

Here's what I have for saving the text file using the preferred format:
Expand|Select|Wrap|Line Numbers
  1. Dim FN As Long
  2. FN = FreeFile
  3. Open "C:\Documents and Settings\Adam.Martin\Desktop\UNPW.txt" For Output As FN
  4. Print #FN, txtUsername.Text + ";" + txtPassword.Text
  5. Close FN
  6.  
and here's the other coding I have so far for the comparison:
Expand|Select|Wrap|Line Numbers
  1. Dim UNPW As String
  2. Dim y As String
  3. Open "C:\Documents and Settings\Adam.Martin\Desktop\UNPW.txt" For Input As 1
  4. Do Until EOF(1)
  5. y = InStr(1, 1, txtUsername.tezt + "&" + txtPassword.Text)
  6. If txtUsername.Text + "&" + txtPassword.Text = y Then
  7. Unload Me
  8. frmWelcome.Show
  9. Else
  10. Unload Me
  11. frmUnauthorized.Show
  12. End If
  13. End Sub
  14.  
Anybody have an idea how I can finish this up?
Sep 29 '08 #1
1 2631
risk32
98
Nevermind, found my errors... and did it a different way. for those interested:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdLogin_Click()
  2. Dim y As String
  3. Open "C:\Documents and Settings\Adam.Martin\Desktop\UNPW.txt" For Input As #1
  4. Do Until EOF(1)
  5. Input #1, y
  6. Exit Do
  7. Loop
  8. Close #1
  9. If y = txtUsername.Text + "&" + txtPassword.Text Then
  10. .........
  11.  
Sep 29 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: DCM Fan | last post by:
Access 2K, SP3 on Windows 2K, SP4 All, I have an import spec set up with quoted Identifiers and comma-separated values. The text file is produced by a 3rd-party program of which I have no...
1
by: mark | last post by:
In Access 2000 and 2002, I have created an import specification to import the fixed-width recordset below into an existing table. I am having strange problems with the import of the date and time...
1
by: Dan | last post by:
Could someone please help me with auto importing a series of data files into an Access table. I tried to follow code given below in a previous messagebut i'm getting error messages. Here's my...
3
by: deko | last post by:
I've been trying to use the Access Import Wizard to expedite importing data into my mdb. The nice thing about the wizard is that I can import from different file formats - txt, xls, even Outlook -...
8
by: Nick M | last post by:
Hello All, Excellent info here Thanks! I am very new to using access in general and I am on a learning curve. I'm trying to import an excel workbook (with worksheets) into an access db via a...
1
by: ghadley_00 | last post by:
Hi, I have a MS access database table for which I regularly need to import fixed width text data. At present I have to to cut and paste the text data from its source to a text file, save the...
0
by: NewbieSupreme | last post by:
I'm using PHPMyAdmin on an Apache2Triad install (latest version; 5.x.x, which installs PHP5 and PHPMyAdmin 2.8 as well). In Access, I exported a table to a text file, tab-delimited, text qualifyer...
7
by: Alan | last post by:
Hi. I have programmed in C++ before, but I`m a couple of years out of practice. I am seeking some advice on getting started on a quickie project. . . . I have to read a 54MB text file and do a...
49
by: Martin Unsal | last post by:
I'm using Python for what is becoming a sizeable project and I'm already running into problems organizing code and importing packages. I feel like the Python package system, in particular the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.