Start as Long String for MID

jsparker

Sr. Data Technician
Local time
Today, 06:31
Joined
Jun 27, 2008
Messages
24
Ok, I know this is easy but I can't find the answer and hoping you all can pop an answer to me.

I am reviewing a database with a number of MID string statements. I understand the first number is the location and the second is the length. What I'm failing to understand is how you calculate the first number to "Star As Long" off of a document.

I've reviewed the document that a number of MID statements pull from on this database (its pulling from a .PRN file) but don't understand how the coordinate is calculated.

Any help?
 
How about asking your question another way. I'm having a problem understanding what you want. Maybe an example would help.
 
Understood. I apologize. The database is pulling from a .PRN doc with the following code.

If stEMPNO > "000000" and stEmpNo < "999999" then
stWeekEnding = Mid(stRecord, 141, 10)
stCode = Mid(stRecord, 191, 10)
stHours = Min(stRecord, 84, 6)

Ok. So I understand the first number in the MID string is the location of the record and the second number is the length of the capture. And I've gone through the .PRN document to understand which column 141, 191 and 84 are respectively but what I'm trying to understand is how whomever created this database came up with those coordinate numbers to begin with. Is it how many spaces over from the left margin or what?

Hope that helps.
 
...but what I'm trying to understand is how whomever created this database came up with those coordinate numbers to begin with. Is it how many spaces over from the left margin or what?

Hope that helps.
Yes it does, and thanks. A .PRN file is text ready for a printer and YES, they just printed it out and counted the characters from the left.
 
Yes it does, and thanks. A .PRN file is text ready for a printer and YES, they just printed it out and counted the characters from the left.


Appreciate it. I kinda had that in my head but thought, "Nah, this person used some sort of high tech feature to understand the page coordinates and didn't just print it out and count the spaces over."

Thanks again.
 
Sometimes the simplest answer is the correct one. :D
 
another way would be to map the whole string into a typed array or structure, so that the field you are then interested in is then available directlly, without string slicing.

- but i'm not sure if you can overlay a record, or assign a structure directly in that way in vba (although you can in many languages)
 

Users who are viewing this thread

Back
Top Bottom