Kamis, 13 Agustus 2015

Re: [MS_AccessPros] Re: DLookup

 

Duh.


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 3:33 PM, Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Try removing the "AND" since there is only one condition:
 
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 Rate
    Dim varRate As Variant
    varRate = 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 message 
Run-time error '3075':
Syntax error (missing operator) in query expression "AND Product =
'XXXXXXX".

Private Sub cmbPricePerPiece_GotFocus()
    Dim varPrice As Variant
  
    varPrice = DLookup("PricePerPiece", "ProductForClaimPerPiece", _
        "' AND Product = '" & Me.cboProduct & "'")
    Me.PricePerPc = Nz(varPrice, 0)
End Sub

What 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 (35)

.

__,_._,___

Tidak ada komentar:

Posting Komentar