Dcount problem

krzysiekk

Registered User.
Local time
Today, 02:29
Joined
Dec 2, 2009
Messages
74
Hi I just tested dcount and working when returning 0 but if not showing error 3464

If DCount("*", "cost", "order_no='" & Me.Text0 & "' AND pallet_cost='" & Me.Text2 & "'") = 0 Then

Please advise
 
Try this

Code:
If DCount("*", "cost", "order_no= " & Me.Text0 & " AND pallet_cost= " & Me.Text2 & " ") = 0 Then

You may be concatenating when you don't need too.
 
Is palet cost a number if so take out the single quotes

If DCount("*", "cost", "order_no='" & Me.Text0 & "' AND pallet_cost=" & Me.Text2 ) = 0 Then

Same applies for Order no
 
I change and still inserting but not updateing,

If DCount("*", "cost", "order_no='" & Me.Text0 & "' AND pallet_cost=" & Me.Text2) = 0 Then

DoCmd.SetWarnings False
DoCmd.RunSQL "insert into cost ([order_no], [pallet_cost]) Values ([Forms]![Form3]![Text0], [Forms]![Form3]![Text2])"

Else
DoCmd.RunSQL "Update cost set pallet_cost = [Forms]![Form3]![Text2] where order_no = [Forms]![Form3]![Text0]"

End If
 
Code:
DoCmd.RunSQL "Update cost set pallet_cost = " & Me.Text2 & " where order_no =  '" & me.Text0 & "'"
 
DoCmd.RunSQL "Update cost set pallet_cost = " & Me.Text2 & " where order_no = '" & me.Text0 & "'"

still not updating, strange when I created separate event just for

Code:
DoCmd.RunSQL "Update cost set pallet_cost = [Forms]![Form3]![Text2] where order_no = [Forms]![Form3]![Text0]"

working fine. Order No - text / pallet_cost - number
I using MS Access 2003
 

Users who are viewing this thread

Back
Top Bottom