I will try and explain this a best possible hopefully it will make sense.
I have a form with 4 text boxes, text1, text2 text3 and text4
I have a button which adds the values in these text boxes to a table. It adds text1 and text2 as a row , then text1 and text3 and finially then text1 and text4 as a row.
Using the following code.
DoCmd.RunSQL "Insert into suppliers(supplier_id,supplier_name) Values (Text1.Value,Text2.Value);"
DoCmd.RunSQL "Insert into suppliers(supplier_id,supplier_name) Values (Text1.Value,Text3.Value);"
DoCmd.RunSQL "Insert into suppliers(supplier_id,supplier_name) Values (Text1.Value,Text4.Value);"
I would like these rows to only be added if the second text box so text2, text3 or text4 have a value. Therefore if text boxes 2 and 4 don't have values only the row with text box 1 and 3 is added to the table.
I don't really know what I am doing now but have tried with If statements and various other methods but had no joy.
I have a form with 4 text boxes, text1, text2 text3 and text4
I have a button which adds the values in these text boxes to a table. It adds text1 and text2 as a row , then text1 and text3 and finially then text1 and text4 as a row.
Using the following code.
DoCmd.RunSQL "Insert into suppliers(supplier_id,supplier_name) Values (Text1.Value,Text2.Value);"
DoCmd.RunSQL "Insert into suppliers(supplier_id,supplier_name) Values (Text1.Value,Text3.Value);"
DoCmd.RunSQL "Insert into suppliers(supplier_id,supplier_name) Values (Text1.Value,Text4.Value);"
I would like these rows to only be added if the second text box so text2, text3 or text4 have a value. Therefore if text boxes 2 and 4 don't have values only the row with text box 1 and 3 is added to the table.
I don't really know what I am doing now but have tried with If statements and various other methods but had no joy.