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!

Access 2000 Input # Statement Issue 1

Status
Not open for further replies.

FateFirst

Programmer
Apr 15, 2002
212
GB
Hi there.

I have a CSV file. I want to import it into a table, but my reasons for using the 'Input# Statement' way to import the data is due to the need to run various checks etc etc per record line.

Anyways, my problem occurs when assigning data to their variables. For some reason it will only take the first part of any date (anything before the first slash). The field in the CSV file reads something like: 26/11/2002, but the variable holding the date only has 26 as its data. Any idea why this is happening or another way to import the data which would allow this to work.

I have tried declaring the date variable as a string/date to see if this makes any difference, but this doesnt.

Am I missing something here, does the input statement not like the character / in the data?

Please help...and sorry if my explanation isnt any good. - FateFirst
 

Give something like this a try...
[tt]
Dim FName As String, FNumb As Integer, S As String, MyArray() As String

FName = "Your Path File Name"
FNumb = FreeFile

Open FName For Input As #FNumb

Do While Not Eof(FNumb)
Line Input #FNumb, S
MyArray = Split(S, ",")
For I = LBound(MyArray) To UBound(MyArray)
Debub.Print MyArray(I)
Next I
Loop

Close #FNumb
[/tt]

Maybe something like this will help. Good Luck

 
Well all I can say it THANKS....even though I worked it out anyways and changed my code to almost exactly the above last night.

You get a star anyways...thanks!!! - FateFirst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top