Question about Business & Productivity Software

1 Answer

How to pass table name as string to select query in access

I want to create simple select query but in this table name is string value so how can i select those records of that table which was passes as string

eg: select * from '[tablename]'

please give me solution as soon as possible.thank you.

Posted by on

1 Answer

  • Level 1:

    An expert who has achieved level 1.


    An expert that gotĀ 5 achievements.


    An expert whose answer gotĀ voted for 20 times.


    An expert who has answered 20 questions.

  • Contributor
  • 28 Answers
Re: how to pass table name as string to select query in access - Business & Productivity Software

What software are you using to query?

Posted on Dec 30, 2007

Add Your Answer

0 characters

Uploading: 0%


Complete. Click "Add" to insert your video. Add


3 Points

Related Questions:

2 Answers

Access database was copied now no tables in dropdown list

Your version of Access may require slightly different menus and clicks than mine, but the procedure is straightforward and should be very similar to what you will need to do. Read the whole post first!

Make sure you have permission to modify the database, then go to the form (I assume the drop-down table is in a form) and go to design view.

In design view, click once on the dropdown box you are having a problem with, and a properties screen with several tabs should pop up; click on the data tab, and look at 'data source'. In the list look for 'row source type' to see if the source of your data is a) a table or a query, b) a value list or c) a field list. Most dropdown boxes use either a value list or data from another table or a query (based on a table).

Check the source of data by going down to the next line in the list titled 'Row Source' (this is the list on the data tab that popped up when you clicked on the dropdown box in design view).

If the source is a table/query type you should see some code in the Row Source box like "SELECT....". Without changing anything, click once immediately to the right of the box, and whatever source the rows are coming from should pop up--if a query, for instance, it will pop up the underlying query in design view.

You should be able to troubleshoot the underlying query to see why no data is given in the dropdown box.

Another point where underlying query or table is used: If the table was based on a query that pulls data from the records in the current database, the drop down list will be blank until new records are added so the query has something to list.

And if the source is a 'value list', the values should be included in the row source box below, separated by semicolons. If not you simply need to add them in.

If your source is a field list, go back to whomever copied the database and tell them you need help with the copy they gave you...

Sep 13, 2009 | Microsoft OFFICE 2003 BASIC OEM ENGLISH MS...

1 Answer

Application and example of relationship in access


After you've set up multiple tables in your Microsoft Access database, you need a way of telling Access how to bring that information back together again. The first step in this process is to define relationships between your tables. After you've done that, you can create queries, forms, and reports to display information from several tables at once.

A relationship works by matching data in key fields - usually a field with the same name in both tables. In most cases, these matching fields are the primary key from one table, which provides a unique identifier for each record, and a foreign key in the other table. For example, teachers can be associated with the students they're responsible for by creating a relationship between the teacher's table and the student's table using the TeacherID fields.

Having met the criteria above, follow these steps for creating relationships between tables.
  1. In the database window view, at the top, click on Tools ---> Relationships
  2. Select the Tables you want to link together, by clicking on them and selecting the Add Button
  3. Drag the primary key of the Parent table (Teacher in this case), and drop it into the same field in the Child table (Student in this case.)
  4. Select Enforce Referential Integrity
    • When the Cascade Update Related Fields check box is set, changing a primary key value in the primary table automatically updates the matching value in all related records.
    • When the Cascade Delete Related Records check box is set, deleting a record in the primary table deletes any related records in the related table
  5. Click Create and Save the Relationship

Apr 09, 2009 | Microsoft Business & Productivity Software

1 Answer

Time based triggers or procedures

Syntax to create Triggers in SQL are :

Create Trigger trigger_name // "trigger_name" : Give name to the trigger
table_name // "table_name" : name of the table on which trigger has to created
for Update


// Here Query has to be written here


Dec 18, 2008 | Microsoft Business & Productivity Software

1 Answer

How to print only selected fields in ms access.

open your table in query, follow steps to do this...

1. open new query in access
2. locate the table
3. once table selected, select field name in selected table you only want to include in query
3. once finished selecting the field save the query
4. you can now view selected field in your table and print as well
5. you can edit the query anytime if you want to add or remove field
6. query will not affect your table since this is only query.

hope this will help you....

Oct 22, 2008 | Microsoft Access 2002 for PC

1 Answer

Creating a table in Ms-Access

Have you tried to name the table Tiny_tots? it might make it work. Sometimes programs are funny about letting you have spaces in the name.

Oct 04, 2008 | Microsoft Office Standard for PC

1 Answer

Microsoft Access Query

Your date form is what it wrong. In order to use dates in Access with a BETWEEN function clause the values have to specifically be dates.

You can create dates in literal strings using the # sign to bound them, as in:

Select DISTINCT [ActivityDate] between #1/1/08# and #12/31/08#

#....# tells Access to treat this literal string as a date.

If you are using non-literal values, such as a parameter handed into the query, which would then be a variable, you can't use #some_variable# to cause Access to view it as a Date since #...# is for literal values only. To convert (also called "casting" a variable), use the CDate function. CDate likes to know what format to expect the string to come in though so it helps to pass that along, as in:

Select DISTINCT [ActivityDate] between CDate(begin_dt_string) and CDate(end_dt_string)

Remember the date string you pass into CDate has to be readable as a date by CDate. So make sure you pass in something that it can handle (use the IsDate() function to check to be sure so you can avoid a runtime datatype casting error). If your locale is US, then passing in x/y/z it will take for MM/DD/YYYY. If Europe, it will take it as DD/MM/YYYY. So keep that in mind.

To convert out of a date, use the FORMAT() function. That is how you get a date data type value to become a string value.

More fun reading:

Hope this helps!

Feb 11, 2008 | Microsoft Office Access 2003 (077-02871)...

3 Answers

Sql Server 2005

select,age,department from int newtable n1,n2 where

Dec 10, 2007 | Microsoft SQL Server 2000 Standard Edition...

1 Answer

Ms access

Stored Procedures don't exist in MS Access. You do have the following options though. Queries, which are just select or action queries. VB Code, which you can write using Query Objects as if you were writing a Visual Basic application. These can be Functions or Subroutines. In these, you would use the standard programming techniques with while and for loops, etc.

You can create complex situations combining the two of these. A function in the VB code area can accept through parameters, the single values (line by line, record by record) in a query and act on them and manipulate the values.

For example: create a query that does a select phone from address. Create a function in vb called public function StripDashesInPhone(Phone as string) which then uses VB coding to strip dashes from each phone value passed in. To make it all work, in the query on one of the field columns put "NewPhone: StripDashesInPhone([Phone])" and for every record processed in the query, the function is called with the [Phone] field value passed in to the function and the action is processed and returned.

Other than writing a function that is activated by a form button click, which opens the current db and opens a table and process it, just like in VB, this is about as close to cursors and oracle procedures as you get.

I wish it was more, but ...

Oct 09, 2007 | Microsoft Office Standard for PC

3 Answers

Viewing ms Sql Server database on Access

Are you familiar with "Linking" tables in Access? In Access: File --> Get External Data --> Link Tables. This will bring up a dialog box which allows you to browse to your SQL server and select the table you want.

Aug 23, 2007 | Microsoft SQL Server Standard Edition for...

4 Answers

Running SQL queries on Excel

Another way to do it is to use the SQL Drill freeware Excel addin (

Aug 14, 2007 | Microsoft Office 2003 Basic Edition...

Not finding what you are looking for?
Business & Productivity Software Logo

Related Topics:

1,010 people viewed this question

Ask a Question

Usually answered in minutes!

Top Business & Productivity Software Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers


Level 3 Expert

18257 Answers

Sudeep Chatterjee
Sudeep Chatterjee

Level 3 Expert

3267 Answers

Are you a Business and Productivity Software Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides