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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex Problem

Status
Not open for further replies.

Aqif

Programmer
Apr 27, 2002
240
AU
Hi :)

In my table I have a stage field and the maximum length of Stage field is 6. The stage can be like

IA, IIA, IVa etc

I want to export the field in an old database where they extract the field by defining the String Position. Therefore They want me to write stage in a way that if the stage is null then have six spaces and if stage is 2 characters rhen 4 spaces should follow after that and then rest of the field. The data should look smthng like this

IA + 4 spaces + next field

I am trying something like this

IIF(Len([Stage]=0)," ",IIF(Len([Stage]=1),[Stage] & " ") and so on.........

Is there any better way to do the thngs. By the way none of my stage is 6 characters long :(

Cheers!
Aqif
Cheers!
Aqif
 
well, you could try something like

Do While (Len([Stage]) < 6)
[Stage] = [Stage] & &quot; &quot;
Loop

of course youll need another do loop to do this until eof. ;)

just check the length of the string and if its smaller than six, just add another blank.
 
Left([Stage] & &quot;000000&quot;, 6)
MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top