Khalid-
What is the exact error message you're getting now?
Also, why are you using GotFocus? I would think AfterUpdate of cboProduct would work better. I assume that cboProduct is bound to the product name, correct?
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 9:00 AM, khalidtanweerburrah@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
John,
---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :
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: John Viescas <johnv@msn.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (33) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar