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!

String Manupulation formula 1

Status
Not open for further replies.

yog2go

Programmer
Jul 22, 2004
18
US
Hi everyone,
Need some help with the formula.

dim Terms as number
Terms = TONUMBER(RIGHT({vwRPTPurchaseOrder.Terms}, 2))
formula = DateAdd("d", Terms, vwRPTPurchaseOrder.RequestDate})

'Extracts last two letter or number
'If it it a number then add in to the Request date. If they are letters then I would like to display "Due Upon Receipt". How can i write this formula??

Thanks in advance.
 
I think this should do it for you.
Code:
dim Terms as string
Terms = RIGHT({vwRPTPurchaseOrder.Terms}, 2)

if isnumeric(Terms) then
    formula = totext(DateAdd("d", val(Terms), {vwRPTPurchaseOrder.RequestDate}),"MM/dd/yyyy")
else
    formula = "Due Upon Receipt"
end if

The keys here are that you need to check the value to see if it is numeric, and then your IF statement needs to return the same data type on both ends. I used the totext function to change the date field to text in the format I wanted. Take a look at the totext function if you need to format it differently.

~Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top