limited characters per line

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
i need to export query results into text file. i'm doing this suing VBA but
the problem is that i have only 150 charcters per line, how do i keep track
of this? do i need a counter? how?
Thank you
 
What do you want to count?
150 characters per line where?
So what do you want to do when you get to 150?
Please post more detail
 
hi
i need to export query results into text file. i'm doing this suing VBA but
the problem is that i have only 150 charcters per line, how do i keep track
of this? do i need a counter? how?
Thank you

You haven't given enough information.
If you wish to restrict user entry into a field, you can use, in the
control's Change event:

If Len(Me![ControlName].Text) >150 Then
MsgBox "You have entered 150 characters"
[NextControl].SetFocus
End If

If you mean something else, post back with more info.
 
thank you for responding to my post. i'm sorry my question wasn't clear.
this is what i want: i have a query which i want to export its result into a
text file.
the text file has a limitation that the line length shouldn't be more than
150 characters. and the each individual field from the query has a predefined
length in the text file.
so for each field from the query that i export into the text file i should
keep track how many characters i'm exporting so that if they exceed the
predefined length i should chop the extra characters and if they are less
than the pre defined length i add nulls, all while keeping in mind that the
whole line doesn't exceed 150 characters.
hope this was clear.. thank you
 
thank you for responding to my post. i'm sorry my question wasn't clear.
this is what i want: i have a query which i want to export its result into a
text file.
the text file has a limitation that the line length shouldn't be more than
150 characters. and the each individual field from the query has a predefined
length in the text file.
so for each field from the query that i export into the text file i should
keep track how many characters i'm exporting so that if they exceed the
predefined length i should chop the extra characters and if they are less
than the pre defined length i add nulls, all while keeping in mind that the
whole line doesn't exceed 150 characters.
hope this was clear.. thank you

Update the table before exporting the file.

Back up your data first!!!

Create an Update query.
Update YourTable Set YourTable.FieldName =
IIf(Len([FieldName])>=150,Left([FieldName],150),Space$(150-Len([FieldName]))
& [FieldName]);
 
the text file has a limitation that the line length shouldn't be more
than 150 characters. and the each individual field from the query has
a predefined length in the text file.

If this is a fixed-width format file, then use the Export wizard to set it
up.


Tim F
 
Back
Top