On Thu, Dec 27, 2001 at 12:11:17AM +0100, [EMAIL PROTECTED] wrote: > Hi everybody, > I really hope that there will be somebody who will waste a > bit of his time helping a very, very beginner. > > I have a front-end database in MS Access that gets data from a MySQL back-end. > > When I execute a "Pass-through Query" it works fine if I write: > > "SELECT Orders.Id, Orders.Number, Orders.Clients_Id > FROM Orders > WHERE Orders.Clients_Id=234 (or whatever number I put in)" > > Instead if I try to get the "WHERE" Clause from a form which is obviously > alredy open in my MS Access front-end and I write: > > "SELECT Orders.Id, Orders.Number, Orders.Clients_Id > FROM Orders > WHERE Orders.Clients_Id=[Forms]![Clients]![Id]" > > I get an "ODBC error: can't connect........" > > I tried then to declare "[Forms]![Clients]![Id]" as a PARAMETER (using "SET > @.......") but, whatever I do and whatever I write, I get a "SINTAX ERROR > MESSAGE".
First, let me get the inevitable joke out of the way. I didn't know they taxed that in Italy. Sir, when you write a pass-through query, everything in the SQL statement is a literal value, and the backend does all the processing. So your pass-through query is asking MySQL to find the Clients_Id in the Orders table that matches the value '[Forms]![Clients]![Id]'. MySQL can't make any sense of this, so it returns an error message. Grab the ID value before writing your query. Then insert the actual ID value into the pass-through query when you write it. So if the ID is 248, your WHERE clause would be "WHERE Orders.Clients_Id = 248;" Remember that MySQL can't read data in Access objects. It can only process whatever is passed to it via ODBC. Bob Hall -- "In the room women come and go, Speaking of database, query, and table." T-Sql Elliot --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php