I have a query inside a form as below
stSql = "SELECT Customer.CUST_ID, Customer.WEIGHT, Customer.START_DATE, Customer.PROJECT " _
& "FROM Customer WHERE " _
& "(Customer.PROJECT='" & Comboproject & "') AND " _
& "(Customer.WEIGHT = " & Nz(txtWeight, "NULL") & ") AND " _
& "(Customer.START_DATE ='" & Nz(txtStartDate, "") & "') "
I'm facing 2 issues with the above query
1. There can be situations where txtWeight can be null, (WEIGHT field type is NUMBER in table). When there is no data entered in txtWeight, I'm getting error message.
2. Also when data is selected from calendar into txtStartDate, i'm getting "data type mismatch ..." error. Do we need to parse the txtStartDate before assigning to Customer.START_DATE as i have seen some ex giving # before and after the date. But still its not working. Can any one please help me out.