Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2010
    Posts
    10

    create a composed queries in access-sql

    Hi everybody !

    I have a access 2003 DB with one table, for ex. which contains the info about the users and their PCs like this:
    | name | PC1 | PC2 | PC3 |
    | Jack |Asus |Lenovo| HP |
    |John | DELL | | |
    |Anna | |Asus | |



    Exist any function in sql query that will jump the fields so that the returned query will be like this:

    | name | PC |
    | Jack | Asus |
    | |Lenovo|
    | | HP |
    |John | DELL |
    |Anna | Asus |

    ?

    And at second, exist any counter type in the sql queries that will count only the fully records, without empty fields so that the returned query will be like this:

    | Nr | name | PC |
    | 1 | Jack | Asus |
    | | |Lenovo|
    | | | HP |
    | 2 |John | DELL |
    | 3 |Anna | Asus |

    ?

    I am new in access and sql so that I don't know many secrets.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Presumably this got the data into the basic format:

    https://www.accessforums.net/queries...03-a-9425.html

    except for the repeating names. The simplest way to get what you want from there is on a report. You can either use Sorting and Grouping to get a single instance of each name, or use the Hide Duplicates property of the textbox containing the name.

    The numbering would be fairly simple using the first method, with a textbox that had a control source of:

    =1

    and its running sum property set to over all.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Nov 2010
    Posts
    10
    Dear pbaldy, give me some examples or more detailed indications to use these instructions, because I trying to create some queries by using that you adviced me but without big success.
    PLEASE, help me to resolve it !!!
    Thanks in advance

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    How about a more detailed question? What query exactly have you tried, and what is wrong with it? I would suspect the query from the other thread returns the correct data, it just repeats the names which you don't want. Either of the methods above would resolve that problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Join Date
    Nov 2010
    Posts
    10
    Quote Originally Posted by pbaldy View Post
    Presumably this got the data into the basic format:

    https://www.accessforums.net/queries...03-a-9425.html

    except for the repeating names. The simplest way to get what you want from there is on a report. You can either use Sorting and Grouping to get a single instance of each name, or use the Hide Duplicates property of the textbox containing the name.

    The numbering would be fairly simple using the first method, with a textbox that had a control source of:

    =1

    and its running sum property set to over all.
    Hello pbaldy,
    I found the solution for my first condition (Exist any function in sql query that will jump the fields) in this way:
    1. in the DB list I added a field with unique ID for each record;
    2. the query will show each PC model with their possesor and unique ID in a new record (line). Result that the names and unique ID will repeat in the query.
    3. I have created a report which will show all the fields of the query, BUT with the following conditions:
    3.a. in the unique ID field I have activated "Hide Duplicates" property
    3.b. in the name field I have indicated the condition =IIf(ID.IsVisible;[name];Null)

    Now I tried to do this for the my second condition (exist any counter type in the sql queries that will count only the fully records, without empty fields) by indicating the =IIf([ID].[IsVisible];Count([Numele]);Null), because I don't understand your solution for this problem (=1).
    Can you provide me more detailed information for this solution ?

  6. #6
    Join Date
    Nov 2010
    Posts
    10
    Quote Originally Posted by pbaldy View Post
    Presumably this got the data into the basic format:

    https://www.accessforums.net/queries...03-a-9425.html

    except for the repeating names. The simplest way to get what you want from there is on a report. You can either use Sorting and Grouping to get a single instance of each name, or use the Hide Duplicates property of the textbox containing the name.

    The numbering would be fairly simple using the first method, with a textbox that had a control source of:

    =1

    and its running sum property set to over all.
    Dear pbaldy,
    please help me to find a solution for the above problem !!!!

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

Similar Threads

  1. Using queries to create new table
    By mradel in forum Queries
    Replies: 1
    Last Post: 10-26-2010, 10:34 PM
  2. Problem with Access Queries\Reports
    By Crysis3nt in forum Access
    Replies: 1
    Last Post: 09-09-2010, 02:26 AM
  3. Create a query in VBA, Access 2007
    By laavista in forum Access
    Replies: 3
    Last Post: 06-22-2010, 07:43 PM
  4. automatically create queries
    By GEORGIA in forum Programming
    Replies: 8
    Last Post: 01-23-2006, 02:35 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