Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 4th, 2004, 04:32 PM
Authorized User
 
Join Date: Sep 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax Error /missing operator in Query Expression

I'm trying to populate a field from another field. I want to enter a product name and have the unit price pop up in another field. Here's what I've written (please keep in mind my only education in Access is basically Northwind). I don't understand all the terms and functions behind Access.
Thanks,
Don...........

Private Sub ProductName_AfterUpdate()
On Error GoTo Err_ProductName_AfterUpdate

    Dim strFiter As String

    'Evaluate filter befroe it's passed to DLookup function.
    strFilter = "ProductName = " & Me!ProductName

    'Look up product's unit price and assign it to UnitPrice control.
   Me!UnitPrice = DLookup("ProductName", "Products", "UnitPrice = " & UnitPrice)

Exit_ProductName_AfterUpdate:
    Exit Sub

Err_ProductName_AfterUpdate:
    MsgBox Err.Description
    Resume Exit_ProductName_AfterUpdate

End Sub


 
Old September 4th, 2004, 05:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Can you post the entire error here?

_________________________
- Vijay G
Strive for Perfection
 
Old September 4th, 2004, 05:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

If you are looking for UnitPrice to be returned from DLookUp then you got to change it as...
Code:
Me!UnitPrice = DLookup("[UnitPrice]", "Products", "[ProductName] = '" &  Me!ProductName & "'")
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old September 4th, 2004, 06:47 PM
Authorized User
 
Join Date: Sep 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much. I think I see how this is done and actually I've added another pop up field to my form based on what you showed me.
Thanks again,
Don........

 
Old September 4th, 2004, 07:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

No Problem. You can check this out for better understanding of DLookup Function.

Description of DLookup() usage, examples, and troubleshooting in Access 2000

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error (missing operator) ppenn Classic ASP Basics 3 November 5th, 2007 02:26 PM
Syntax error (missing operator) in query expressio annwilly Classic ASP Databases 1 June 7th, 2006 09:53 AM
Error - Missing operator in query expression. akibaMaila VB.NET 2002/2003 Basics 1 January 18th, 2005 12:34 PM
Syntax error (missing operator) in query expressio nidy_online Wrox Book Feedback 1 April 30th, 2004 06:40 PM
Syntax error (missing operator) in query expressio mvollmer Classic ASP Databases 7 December 5th, 2003 11:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.