here is what I wrote, does not work
says mystring does not exist
[code] If ComboBox1.text = “AXS- Access Promos” then
if TextField_CD.Text < "10" then
Dim mystring as string = "00"
else
Dim mystring as string = "0"
end
MsgBox field + mystring + TextField_CD.Text + Chr(13) + field + "_" + TextField_CD.Text + "_" + TextField_CUT.Text[/code]
[code] If ComboBox1.text = “AXS- Access Promos” then
if (TextField_CD.Text) < “10” Then
dim mystring as string = “0”
else
dim mystring as string = “00”
end if
MsgBox field + mystring + TextField_CD.Text + Chr(13) + field + "_" + TextField_CD.Text + "_" + TextField_CUT.Text
[code] If ComboBox1.text = “AXS- Access Promos” then
if (TextField_CD.Text) < "10" Then
//this works
MsgBox "00 " + TextField_CD.Text
end if
//this does not, says s does not exits
MsgBox field + s + TextField_CD.Text + Chr(13) + field + "_" + TextField_CD.Text + "_" + TextField_CUT.Text
code < “10” Then
dim mystring as string = “0”
else[/code]
The reason that code did not work is because you dimmed your variable inside the conditional. If…then…else
Once that conditional finished, your var. ceased to exist.
Dim your var. before the conditional then just do assignment within the cond.
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
[code] If ComboBox1.text = “AXS- Access Promos” then
if "0">(TextField_CD.Text) and (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
else
dim mystring as string = "0"
MsgBox field + mystring + TextField_CD.Text + Chr(13) + field + "_" + TextField_CD.Text + "_" + TextField_CUT.Text
end if