i want to unlock a label in a form according to the following condition:
i have a subform in the specific form with data linked to the form by the index key of the table.
in each line of the details form, i have a field "payment date"
in the first form i want to unlock field "real_total"
IF ALL the lines in the details have "payment date" .
so i check what is the count of lines with "payment" according to the id
and the total count of lines for this order
if they are equal, so i can unlock my field "total"
i try this:
******************
Dim stord As String
stord = Format(Me.id_order, "0000"
' SQLstr = "SELECT count(order_details.payment_date) as counter FROM order_details "
' SQLstr = SQLstr & "WHERE (((order_details.id_order)='"
' SQLstr = SQLstr & stord & "') AND ((order_details.payment_date) Is Not Null));"
' Set rs = CurrentDb.OpenRecordset(SQLstr)
' Dim payOrd As Integer
' payOrd = rs.Fields("counter"
'SQLstr = "SELECT count(order_details.payment_date) as counter FROM order_details "
' SQLstr = SQLstr & "WHERE order_details.id_order='" & stord & "';"
'Set rs = CurrentDb.OpenRecordset(SQLstr)
' Dim allOrd As Integer
' allOrd = rs.Fields("counter"
' If allOrd = payOrd Then
' real_total.Locked = False
' End If
*************
but if for one id that dont have "payment date" at all it makes error on:
'Set rs = CurrentDb.OpenRecordset(SQLstr)
if there are like this, it pass this line
but error msg "data type mistach in criteria expression"
what is wrong there????
__________________
viv