Mick wrote:
[Quoted Text] > Hi All > > Am using a form/subform and wish to look up a price from an unrelated > entity. > > Hence subform has: > > [ProductName] which is a text primary key. It needs to look up > [ProductPrice] from tblProduct and return it into [ProductPrice] on > the subform. > > If I hard code it as: > ______________________- > Me!ProductPrice = DLookup("[ProductPrice]", "tblProduct", > "[ProductName] = 'Kayak' ") > ___________________________________ > It works fine. However, when I replace the [ProductName] with a combo > and try: > ____________________________________________________________- > Dim grabvalue As String > > grabvalue = "ProductName = " & "'" & Me!ProductName & "'" > Me!ProductPrice = DLookup("[ProductPrice]", "tblProduct", > "[ProductName] = 'grabvalue' ")
DLookup("[ProductPrice]", "tblProduct", > "[ProductName] = '" & grabvalue & "' ")
That's single quote, double quote after the equal sign and double quote, single quote, double quote after the last "&"
|