Try removing the "AND" since there is only one condition:
varPrice = DLookup("PricePerPiece", "ProductForClaimPerPiece", _
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Thu, 13 Aug 2015 00:00:36 -0700
Subject: [MS_AccessPros] Re: DLookup
John,
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
varPrice = DLookup("PricePerPiece", "ProductForClaimPerPiece", _
"Product = '" & Me.cboProduct & "'")
Duane Hookom, MVP
MS Access
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Thu, 13 Aug 2015 00:00:36 -0700
Subject: [MS_AccessPros] Re: DLookup
John,
Still getting error message.
Khalid
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
Khalid-
Looks like an extra single quote. Try this:
varPrice = DLookup("PricePerPiece", "ProductForClaimPerPiece", _
" AND Product = '" & Me.cboProduct & "'")
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
(Paris, France)
On Aug 13, 2015, at 7:25 AM, Khalid Tanweer khalidtanweerburrah@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:Hi John,I hope you & all group members would be fine.Previously you told me how to use DLookup to get RateDim varRate As VariantvarRate = DLookup("DestinationRate", "tblDestinationRates", _"Destination = '" & Me.cmbDestination & _"' AND ProductNameEnglish = '" & Me.ProductNameEnglish & "'")Me.Rate = Nz(varRate, 0)Now i am trying to get PricePerPiece on a different Form but getting error, i have tried last night but could not get it. On the following code i receive messageRun-time error '3075':Syntax error (missing operator) in query expression "AND Product ='XXXXXXX".Private Sub cmbPricePerPiece_GotFocus()Dim varPrice As VariantvarPrice = DLookup("PricePerPiece", "ProductForClaimPerPiece", _"' AND Product = '" & Me.cboProduct & "'")Me.PricePerPc = Nz(varPrice, 0)End SubWhat i am doing wrong cannot understand. Help needed please.Regards,Khalid
__._,_.___
Posted by: Duane Hookom <duanehookom@hotmail.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (34) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar