Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query problem

Status
Not open for further replies.

virginie

Programmer
Jul 24, 2002
53
IL

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
 
Try changing stord to a Double

Format(Me.id_order, "0000") To
CDblFormat((Me.id_order, "0000"))

 
i try it
but it seems to be an unknown word : CDblFormat

what can it be?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top