A atrium Registered User. Local time Today, 22:17 Joined May 13, 2014 Messages 348 Mar 22, 2021 #1 I tried this and I just keep getting problems with it Error message attached Me.TotNoForSaleFld = DCount("VehicleId", "Vehicles", "[BuyerId] = 0 And [ClientId] = " & Me.ClientsIdFld) Any Help wou;r be appreciated Attachments Capture.PNG 5.2 KB · Views: 115
I tried this and I just keep getting problems with it Error message attached Me.TotNoForSaleFld = DCount("VehicleId", "Vehicles", "[BuyerId] = 0 And [ClientId] = " & Me.ClientsIdFld) Any Help wou;r be appreciated
bob fitz AWF VIP Local time Today, 13:17 Joined May 23, 2011 Messages 4,808 Mar 22, 2021 #2 Try: Me.TotNoForSaleFld = DCount("VehicleId", "Vehicles", "[BuyerId] = 0 And [ClientId] = " & Me.ClientsIdFld & ")
Try: Me.TotNoForSaleFld = DCount("VehicleId", "Vehicles", "[BuyerId] = 0 And [ClientId] = " & Me.ClientsIdFld & ")
The_Doc_Man Immoderate Moderator Staff member Local time Today, 07:17 Joined Feb 28, 2001 Messages 30,839 Mar 22, 2021 #3 atrium said: Me.TotNoForSaleFld = DCount("VehicleId", "Vehicles", "[BuyerId] = 0 And [ClientId] = " & Me.ClientsIdFld) Click to expand... If Me.ClientsldFld is text then your quoting is what is whacking you. Code: Me.TotNoForSaleFld = DCount("VehicleId", "Vehicles", "[BuyerId] = 0 And [ClientId] = '" & Me.ClientsIdFld & "'") Take a careful look at the quoting, recognizing a mix of double-quotes and single-quote/apostrophe.
atrium said: Me.TotNoForSaleFld = DCount("VehicleId", "Vehicles", "[BuyerId] = 0 And [ClientId] = " & Me.ClientsIdFld) Click to expand... If Me.ClientsldFld is text then your quoting is what is whacking you. Code: Me.TotNoForSaleFld = DCount("VehicleId", "Vehicles", "[BuyerId] = 0 And [ClientId] = '" & Me.ClientsIdFld & "'") Take a careful look at the quoting, recognizing a mix of double-quotes and single-quote/apostrophe.
P Pat Hartman Super Moderator Staff member Local time Today, 08:17 Joined Feb 19, 2002 Messages 48,006 Mar 22, 2021 #4 Are you sure that BuyerID is spelled correctly? Also, the DLookup() as it is coded will count only non-null vehicleID's. This may or may not be what you want. The following version will count all the rows returned by the criteria. Me.TotNoForSaleFld = DCount("*", "Vehicles", "[BuyerId] = 0 And [ClientId] = " & Me.ClientsIdFld)
Are you sure that BuyerID is spelled correctly? Also, the DLookup() as it is coded will count only non-null vehicleID's. This may or may not be what you want. The following version will count all the rows returned by the criteria. Me.TotNoForSaleFld = DCount("*", "Vehicles", "[BuyerId] = 0 And [ClientId] = " & Me.ClientsIdFld)