Eval ftn

1. Fion Guest

## Eval ftn

Not so familiar with this can anyone tell me what&#039s wrong with the following code? got a Type mismatch error.<BR>For x = 1 to 5<BR>If eval("document.frmPurchase.txtDesc" & x & ".value" &#060;&#062; "") and eval("document.frmPurchase.txtQty" & x & ".value" = "" ) then<BR>MsgBox "Please fill in corresponding quantity for item " & x,,"New Purchase"<BR>eval("document.frmPurchase.txtQty" + x + ".focus()")<BR>Exit Function<BR>elseif eval("document.frmPurchase.txtDesc" & x & ".value" &#060;&#062; "") and IsNumeric(eval("document.frmPurchase.txtQty" & x & ".value" = false )) then<BR>MsgBox "Please fill in numeric value for quantity",,"New Purchase"<BR>eval("document.frmPurchase.txtQty" + x + ".focus()")<BR>Exit Function<BR>End if<BR>If eval("document.frmPurchase.txtDesc" & x & ".value" &#060;&#062; "") and eval("document.frmPurchase.txtAmt" & x & ".value" = "" ) then<BR>MsgBox "Please fill in corresponding amount for item " & x,,"New Purchase"<BR>eval("document.frmPurchase.txtAmt" + x + ".focus()")<BR>Exit Function<BR>elseif eval("document.frmPurchase.txtDesc" & x & ".value" &#060;&#062; "") and IsNumeric(eval("document.frmPurchase.txtAmt" & x & ".value" = false )) then<BR>MsgBox "Please fill in valid value for amount",,"New Purchase"<BR>eval("document.frmPurchase.txtAmt" + x + ".focus()")<BR>Exit Function<BR>elseif eval("document.frmPurchase.txtDesc" & x & ".value" &#060;&#062; "") and eval("document.frmPurchase.txtAmt" & x & ".value" = "0.00" ) then<BR>MsgBox "Please fill a value of more than 0.00 for amount",,"New Purchase"<BR>eval("document.frmPurchase.txtAmt" + x + ".focus()")<BR>End if<BR>Next<BR><BR>Thanks

2. Larrie Guest

## RE: Eval ftn

You need to close the brackets on each eval and IsNumeric function before the condition eg 1st statement:<BR>If eval("document.frmPurchase.txtDesc" & x & ".value") &#060;&#062; "" and eval("document.frmPurchase.txtQty" & x & ".value") = "" then<BR><BR>etc.<BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•