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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading in a text file through vb to access

Status
Not open for further replies.

ljhaley

MIS
Nov 13, 2002
5
US
I am trying to read a text file (array) into access through VB. This is what I have but no matter what recordset function I try it doen't work. How do I get the information from one row and then move to the next record to get the info from the next row?

Here is what I have:

Do While Not EOF(1)
Input #1, strFName(row, 1), strLName(row, 2), straddress(row, 3), strCity(row, 4), strState(row, 5), strZip(row, 6)
numFiles = numFiles + 1

txtFName.Text = strFName(row, 1)
txtLName.Text = strLName(row, 2)
txtAddress.Text = straddress(row, 3)
txtCity.Text = strCity(row, 4)
txtState.Text = strState(row, 5)
txtZip.Text = strZip(row, 6)
Loop
 
Hi,
You have increment your row and resize you array:

Do While Not EOF(1)
Input #1, strFName(row, 1), strLName(row, 2), straddress(row, 3), strCity(row, 4), strState(row, 5), strZip(row, 6)
'Do not resize for the first row
if row<>0 then
redim preserve strFName(row,1)
redim preserve strLName(row,1)
redim preserve strAddress(row,1)
redim preserve strCity(row,1)
redim preserve strState(row,1)
redim preserve strZip(row,1)
End if
txtFName.Text = strFName(row, 1)
txtLName.Text = strLName(row, 2)
txtAddress.Text = straddress(row, 3)
txtCity.Text = strCity(row, 4)
txtState.Text = strState(row, 5)
txtZip.Text = strZip(row, 6)
row=row+1

Loop Mal'chik [bigglasses]
 
whats up

having trouble extracting a value from a function control in data reports. SUM(YTDSales) is the function iam using and the value is 3,345,653, but how do i get this value so that i may use it elsewhere in the report. any help would save my job haha!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top