Home > Microsoft Access Help > Variable table name? need some urgent help!

Variable table name? need some urgent help!



hey is it possible to have a variable table name;



this is my scenario:

i have four category of products, which i am selecting using a pull down menu. depending upon which the user chooses, a particular table of database shud be searched.



this is what i have been tryn:



tablename=CStr(Request.Form("category"))

strq="Select * from '&tablename&' where (model='" & CStr(Request.Form("model")) & "') ;"



but im getn the error: incomplete query.



been tryn double and single quotes. just not getn it.

please help! have to submit my project morrow!!!!!

    
Guest


No, an item in the FROM clause must be a valid object name. You cannot use expressions for a table name.



As an alternative, you could query the MSysObjects table for a list of table names that match a criteria expression. Then use that list to dynamically build a query with each table.

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved