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

Add trailing place holders to fields 2

Status
Not open for further replies.

man5104

Technical User
Mar 16, 2005
5
US
I have to append 2 fields together but before I do that I need to append spaces to the end of the 1st field to ensure its length is 15 characters. And the 2nd field needs to be 10 characters and therefore it may need spaces too. I can use spaces or the @ symbol as the place holder. For example
if I have 00ANA00AI001 in the first field and XQ01 in the second field I need to combine the two fields and change them to 00ANA00AI001@@@XQ01@@@@@@.

Can anyone help me with the sytax to accomplish this?

Thanks,

Michelle
 
The easiest, though perhaps not very elegant, is probably something like the following:

[tt]const cstrPadString as string "@@@@@@@@@@@@@@@"
msgbox left$(FirstField & cstrPadString",15) & _
left$(SecondField & cstrPadString",10)[/tt]

Roy-Vidar
 
Ouch, wrong forum, though the technique could be used:

NewField: left$(FirstField & "@@@@@@@@@@@@@@@,15) & left$(SecondField & "@@@@@@@@@@",10)

Roy-Vidar
 
Roy,

Thanks for the quick response! I must be applying your solution wrong becuase it isn't working. Here is what I filled into the "Update To field" in the query:

left$([U6 Analog Tags].KKS & "@@@@@@@@@@@@@@@,15) & left$([U6 Analog Tags].Sigdef & "@@@@@@@@@@",10)

This gave a syntax error so I had to remove the " after the 3rd Ampersand, then the sytax was correct but the result didn't pad the first field with trailing zeros up to 15 characters?? It did combine the 2 fields and add @ after the 2nd field. Any more ideas???

Thank you,

Michelle
 
try:
Code:
left$([U6 Analog Tags].KKS & "@@@@@@@@@@@@@@@[COLOR=red]"[/color],15) & left$([U6 Analog Tags].Sigdef & "@@@@@@@@@@",10)
You were on the right track.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 

That worked! Thanks for helping me out.

Michelle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top