Note that there are some explanatory texts on larger screens.

plurals
  1. POIf not Check then Add to Cash
    text
    copied!<p>I ran the below code that Adnan helped me out with last night (Thanks very much Adnan).</p> <p>Basically, the code checks if the amount being entered is check. If it is check, insert the check value into chckval.</p> <p>If it is cash insert the cash value into cashval.</p> <p>So far, it is half working. It inserts the check into the check fieldname and inserts 0 into cash fieldname. This is is working great.</p> <p>What is not working is inserting cash into cash fieldname if the money is cash.</p> <p>It inserts the cash into cash fieldname as it should BUT it also inserts the same amount into check fieldname. This is not good.</p> <p>If it is cash and it is inserted into cash fieldname, I want check value to be 0.</p> <p>Here is the latest code and thanks again.</p> <pre><code>For x = 1 To 5 Step 1 dedval = Gridview1.FindControl("ded" &amp; CStr(x)) chckval = Gridview1.FindControl("chck" &amp; CStr(x)) chcknumval = Gridview1.FindControl("chcknum" &amp; CStr(x)) checkboxval = Gridview1.FindControl("chckBox" &amp; CStr(x)) onetimeval = Gridview1.FindControl("onetime" &amp; CStr(x)) multival = Gridview1.FindControl("multi" &amp; CStr(x)) If chckval.Text &lt;&gt; "" And Not checkboxval.Checked Then cashval = DirectCast(Gridview1.FindControl("chck" &amp; CStr(x)), TextBox).Text Else chckval = Gridview1.FindControl("chck" &amp; CStr(x)) End If If dedval.Text &lt;&gt; "-1" And donatechoice.SelectedItem.Value &lt;&gt; "No" Then sql += "INSERT INTO employee_ded_amts (employee_id, charity_code, check_amt, chcknum, one_time, bi_weekly, cash, donate_choice, date_stamp) " sql += "VALUES ('" &amp; Replace(employee_idLabel.Text, "'", "''") &amp; "','" &amp; Replace(dedval.SelectedValue, "'", "''") &amp; "','" &amp; Replace(chckval.Text, "'", "''") &amp; "','" &amp; Replace(chcknumval.Text, "'", "''") &amp; "','" &amp; Replace(onetimeval.Text, "'", "''") &amp; "','" &amp; multival.Text &amp; "','" &amp; Replace(cashval, "'", "''") &amp; "','" &amp; Replace(donatechoice.SelectedItem.Value, "'", "''") &amp; "','" &amp; Replace(datestamp, "'", "''") &amp; "');" End If If donatechoice.SelectedItem.Value = "No" Then x = 6 sql += "INSERT INTO employee_ded_amts (employee_id, charity_code, check_amt, chcknum, one_time, bi_weekly, cash, donate_choice, date_stamp) " sql += "VALUES ('" &amp; Replace(employee_idLabel.Text, "'", "''") &amp; "','" &amp; Replace(dedval.SelectedValue, "'", "''") &amp; "','" &amp; Replace(chckval.Text, "'", "''") &amp; "','" &amp; Replace(chcknumval.Text, "'", "''") &amp; "','" &amp; Replace(onetimeval.Text, "'", "''") &amp; "','" &amp; Replace(multival.Text, "'", "''") &amp; "','" &amp; Replace(cashval, "'", "''") &amp; "','" &amp; Replace(donatechoice.SelectedItem.Value, "'", "''") &amp; "','" &amp; Replace(datestamp, "'", "''") &amp; "');" End If Next </code></pre> <p>I think there is some issue with the </p> <pre><code>IF chckval.Text &lt;&gt; "" And Not checkboxval.Checked Then </code></pre> <p>statment</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload