Results 1 to 6 of 6
  1. #1
    giladweil is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    10

    query- selecting a table...


    Hi,




    1. How do I create a query that selects all data from a table, when the user selects what table will be displayed (using - [] at the Table line in the qurey does not work)?

    2. If I want to make the choice in the query by the table codes, and not the name of the table (I have a separate MetaData table showing the code of each table), how do I create the connection?

    Thank Watch so match...

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    A query to select all data in the table can be written
    Code:
    SELECT * FROM TableName
    But I think there is much more to your requirement than this.

    What exactly are you trying to do? What experience do you have?

    Who is "the user"?

    How many such "users" will there be?

    We need more context to be helpful to you.

  3. #3
    giladweil is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    10

    Smile I will try-

    I am building a small database (50-60 tables of medium size). The database is Based on access and is part of an- "personal geo database" of ESRI format, though it is not relevant for this question. I built a form that appears automatically when opening the access file, and I want to create a link to a query that selects all the data in a specific table, that the user selects. (I have no programming background, I have used in similar queries [] to express a variable in aspecific field, but it does not work in choosing a table out of several different tables).

    I have a table that gives index numbers for each table name, and I would like the query (=the user input) to search by the numeric code and not by name table.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Do you have a data model?
    You may want to look at
    http://www.databaseanswers.org/data_models/index.htm
    and
    http://www.databaseanswers.org/approach2db_design.htm

    for some general guidelines.

    As for your query, you should post the SQL you are trying to use, and
    show some details of your table structure.

  5. #5
    giladweil is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    10

    Red face Making things simple-

    I'll try to explain the central issue of the question, the rest is less important:

    How do I build a query (in SQL syntax, or with access interface) that shows me all the data in a table which is selected by the user (table name is variable).

    Thanks

  6. #6
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,173
    Hi,

    to to this you will need some simple lines of code:
    I presume the user chosses the tables out of a list or combo box on a form, and the data are shown in a subform. In this case you can add some code to the After Update event of the list that resembles:

    Me.NameSubForm.Form.RecordSource = me.NameList

    gr
    NG

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Selecting Unique SETS of rows in Access Query
    By dalessandroh in forum Queries
    Replies: 0
    Last Post: 11-09-2010, 10:42 PM
  2. Selecting a corresponding table field based on text field.
    By michaeljohnh in forum Programming
    Replies: 5
    Last Post: 10-08-2010, 10:33 AM
  3. Selecting the last value of the table and show
    By dada in forum Programming
    Replies: 3
    Last Post: 08-21-2010, 01:14 AM
  4. Replies: 2
    Last Post: 10-27-2009, 07:09 AM
  5. Replies: 1
    Last Post: 03-17-2006, 12:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums