query problem (1 Viewer)

vivou

Registered User.
Local time
Today, 17:07
Joined
Dec 15, 2002
Messages
16
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").Value


'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").Value

' 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
 
[sarcasm]I don't think you've posted this in the Reports forum yet[/sarcasm]
 

Users who are viewing this thread

Back
Top Bottom