Hey all,
I have 3 fields on a form. If any of theses fields contain a value then I want to write a record to a database. I've got all the logic down to write to the database, but I'm having problems with a complicated IF Then statement.
The three fields are stored in variables - strNewPay, strNewAcct, strNewTitle. I only want to write to the database if any of these fields contain data. It can be any combination of these 3....1, 2, all, etc.
I can make it work if all fields contain a value, but I'm struggling to get it to work with all the possible combinations.
If strNewPay <> "" and strNewLaborAcct <> "" and strNewTitle <> "" and Rs.Recordcount = 0 then
Rs.Addnew
Any advice would be greatly appreciated. I've tried mnay different If Then statements but can't seem to get it right.
I have 3 fields on a form. If any of theses fields contain a value then I want to write a record to a database. I've got all the logic down to write to the database, but I'm having problems with a complicated IF Then statement.
The three fields are stored in variables - strNewPay, strNewAcct, strNewTitle. I only want to write to the database if any of these fields contain data. It can be any combination of these 3....1, 2, all, etc.
I can make it work if all fields contain a value, but I'm struggling to get it to work with all the possible combinations.
If strNewPay <> "" and strNewLaborAcct <> "" and strNewTitle <> "" and Rs.Recordcount = 0 then
Rs.Addnew
Any advice would be greatly appreciated. I've tried mnay different If Then statements but can't seem to get it right.