if x is less than y

same result

[code] If ComboBox1.text = “AXS- Access Promos” then
if (TextField_CD.Text) < “10” then
dim mystring As string = “00”
MsgBox field + mystring + TextField_CD.Text + Chr(13) + field + “" + TextField_CD.Text + "” + TextField_CUT.Text

  if (TextField_CD.Text) > "9" then
    dim mystring2 As string = "0"
    MsgBox field + mystring2 + TextField_CD.Text + Chr(13) + field + "_" +  TextField_CD.Text + "_" + TextField_CUT.Text
  end
end

end if[/code]

[quote]if CD=1 it works I get 001
if CD=2-9 it DOES NOT WORK, I get 02,03,04 instead of 002,003,004
if CD=10 it works I get 010,011,012[/quote]

“2” is less than “20”
“6” is greater than “20”
because they are strings, and it compares the characters , not the value

Turn the text into an integer first

dim v as integer
v = val(TextField_CD.Text)

msgbox   MsgBox  field + format(v,"000")  + Chr(13)  //  ...etc
//the format statement does what you want.. you always get 3 digits

Shawn, read the introduction as Michel suggested. You are missing the most basic things, like the difference between integer and string.

Strings sort like this:

1
10
2
20
3
…

Integers sort like this

1
2
3
10
20
30

Sorry to say that, but you are wasting a LOT of time (yours and others) by not reading the basics.

hey marcus, I agree, no harm, I’m a newbie trying to make a lot of progress fast, I am way ahead of myself. back to square 1.

No harm in starting up. We all did. But it is of major importance that you get a sound grasp of the fundamentals, to avoid a life of pain and confusion. Sure, Xojo will let you do all sorts of things without reading anything, but that will come back to haunt you at every corner later.

In particular, it is paramount you wrap your head about variable types and scope. Otherwise, you will end up like here stumbling on a very basic snippet.