V
vtj
An existing program is trying to use the following to create a file that is
exported as an ASCII file. The field ‘Appr’ may be an alphanumeric value or
spaces and is three positions. It can not be ‘000.’ When there is a value,
the insert works great. But when there are spaces in the field, nothing (not
blanks, nulls, or spaces) is put in that position. That creates an error in
the ASCII file as everything thereafter is shifted three spaces left with the
effect of ‘bombing’ the batch.
Is there a way to fix this or will I have to build the file ‘Main’ using
some form of command that will allow an 'IIF' test to see if it is null and
therefore am able to force spaces into the file or pass the value that is in
the field?
DoCmd.RunSQL "insert into Main (Counter, AcctNbr, RecType, Data) " & _
"Select [RecCount], [Acct], ""L"", " & _
"'" & [Fix1] & [JulianDate] & [Fix2] & "' & " & _
"[Agcy] & '" & [Fix25] & "' & [Loc] & '" & [DocNumber1] & "' & "
& _
"format([reccount],""000"") & '" & [DocNumber2] & [Fix3] & "' &
" & _
"[Fund] & '" & [Fix25] & "' & [Agcy] & [Orgn] & " & _
"'" & [Fix4] & "' & " & _
"[RSC] & '" & [Fix45] & [Fix44] & "' & " & _
"'" & [Fix5] & [LineDesc] & "' & " & _
"Format([Total], ""00000000000000"") & " & _
"'" & [Fix6] & "' & " & _
"[Appr] & " & _
"'" & [Fix7] & [Fix8] & [Fix9] & "' " & _
"From Temp3"
Thanks for your help!!!
exported as an ASCII file. The field ‘Appr’ may be an alphanumeric value or
spaces and is three positions. It can not be ‘000.’ When there is a value,
the insert works great. But when there are spaces in the field, nothing (not
blanks, nulls, or spaces) is put in that position. That creates an error in
the ASCII file as everything thereafter is shifted three spaces left with the
effect of ‘bombing’ the batch.
Is there a way to fix this or will I have to build the file ‘Main’ using
some form of command that will allow an 'IIF' test to see if it is null and
therefore am able to force spaces into the file or pass the value that is in
the field?
DoCmd.RunSQL "insert into Main (Counter, AcctNbr, RecType, Data) " & _
"Select [RecCount], [Acct], ""L"", " & _
"'" & [Fix1] & [JulianDate] & [Fix2] & "' & " & _
"[Agcy] & '" & [Fix25] & "' & [Loc] & '" & [DocNumber1] & "' & "
& _
"format([reccount],""000"") & '" & [DocNumber2] & [Fix3] & "' &
" & _
"[Fund] & '" & [Fix25] & "' & [Agcy] & [Orgn] & " & _
"'" & [Fix4] & "' & " & _
"[RSC] & '" & [Fix45] & [Fix44] & "' & " & _
"'" & [Fix5] & [LineDesc] & "' & " & _
"Format([Total], ""00000000000000"") & " & _
"'" & [Fix6] & "' & " & _
"[Appr] & " & _
"'" & [Fix7] & [Fix8] & [Fix9] & "' " & _
"From Temp3"
Thanks for your help!!!