Setting the format on a field in a form

mduranko

New Member
Joined
Jan 20, 2004
Messages
2
I have a number field on a form. I need to assign a prefix to the front of the number, example 1234 needs to appear as ZR1234. I know how to do this in the properties format field but it's not that simple. I need to build a code that sets the prefix to one thing if the number is less then 10,000 and to another prefix if the number is greater than 10,000. I have built a code using if, then else as well as the format function but it won't recognize the field as a number when I create the event procedure. I am writing the event on the form "OnOpen" property.

Any suggestions on what I'm doing wrong?

Thanks a bunch
Mike
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Can't you accomplish this with an expression


=IIf([TestField]>10000,"ZR" & [ResultField],"AR" & [ResultField])



Ziggy
 
Upvote 0

Forum statistics

Threads
1,221,618
Messages
6,160,853
Members
451,674
Latest member
TJPsmt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top