Importing Data + Module + strFileData is blank

Moxioron

Active Member
Joined
Mar 17, 2008
Messages
436
Office Version
  1. 2019
Hello all.

I am stumped. I have a module in Access that I am using to import data from a text file. Because the data I am importing has two lines per transaction, I am trying to bring both lines in.

This is what I have in VB:

If StrComp(Mid(strFileData, 61, 4), ".00 ", vbBinaryCompare) = 0 Then
strShortName = Mid(strFileData, 15, 26)
'End If

I had to put a space after .00 because the line above is also monetary, but has a - behind it. If I don't put a space behind the .00, Visual Basic is looking at both lines and pulls in data all ove the place.

When I put the space after the .00, nothing is being imported.

Any ideas or advice? Thank you for your help.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hitech coach. I tried that code on another report, and I am getting a Run-Time error '62'. When I select debug the second strLineIn is highlighted:

Do
' get first line
Line Input #FH, strLineIn
strLineOut = strLineIn
' get second line
Line Input #FH, strLineIn
strLineOut = strLineOut & " " & strLineIn

An example of the data file prior to conversion:

XXXXXXXXX939 R Kelly W 04/13/11 100.00 05-21 13.45.33 1,833.31 C 26380
2 451.35 100.00 0.00 05-21 13.47.40 300.00 D 26380
0 0.00 0 05-22 10.58.16 151.35 D 27264


Sometimes there is just one line and sometimes there are five.

Any idea where I am going wrong? Thanks for your help.
 
Last edited:
Upvote 0
Really need to see all the code used for this task. The issue could be with a previous line of code.

Please post all the VBA code for the procedure.
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,331
Members
452,907
Latest member
Roland Deschain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top