I have a piece of code that takes the values from a couple of fields in an unbound form and insert them in a table using SQL. It works fine.
However, I need to do a some controls before I insert the values, and I can't figure out how to do it.
This is what I need:
1) A check if the value from the listbox lstproducts exist in tblBookingList. If it does not exist it should be inserted and everything is fine.
2) However, if the value does exist I need to compare the txtOutdate value in the form with the Outdate field in tblBookinglist. If the dates match, the insertion should be stopped. If the dates does not match, the values can be inserted. There can be several occurrencies of the value with different dates, and none of these dates are allowed to match.
Thanks in advance.
However, I need to do a some controls before I insert the values, and I can't figure out how to do it.
This is what I need:
1) A check if the value from the listbox lstproducts exist in tblBookingList. If it does not exist it should be inserted and everything is fine.
2) However, if the value does exist I need to compare the txtOutdate value in the form with the Outdate field in tblBookinglist. If the dates match, the insertion should be stopped. If the dates does not match, the values can be inserted. There can be several occurrencies of the value with different dates, and none of these dates are allowed to match.
Thanks in advance.