Results 1 to 5 of 5
  1. #1
    dipique is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    31

    Odd query to turn a table generated by Joomla into useful data

    I manage a web site and users fill out a form on the web site. The site is built on Joomla, and there's a little module that handles the form for me. It puts the data in a weird format though, like this:



    Form
    Name:
    Phone Number:
    Comment:

    Data
    ID Record Question Type Value
    1 1 Name Text Bill Johnson
    2 1 Phone Number Number 1234567890
    3 1 Comment Text This is awesome!
    4 2 Name Text Mark Myers
    5 2 Phone Number Number 7546551231
    6 2 Comment Text This is my comment.
    7 3 Name Text Phil Connor
    8 3 Phone Number Number 38217483719
    9 3 Comment Text I hrt test data!

    I would like to use a query to turn this data into a standard format, like this:

    Record Name Phone Number Comment
    1 Bill Johnson 1234567890 This is awesome!
    2 Mark Myers 7546551231 This is my comment.
    3 Phil Connor 38217483719 I hrt test data!

    This goes beyond my knowledge of Access or SQL. Any ideas? An ideal solution wouldn't use any access-specific query elements, but I can live with non-ideal.

    Thanks!

    Dan

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    One way to do this is to create three queries:
    1. Just return the records where "Question = Name"
    2. Just return the records where "Question = Phone Number"
    3. Just return the records where "Question = Comment"

    Then, create a new query, joining these three queries on your Record field, and return the appropriate field from each query, and you should have what you want!

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,543
    You could also use a crosstab querry. See attached DB
    Attached Files Attached Files
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    dipique is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    31
    Quote Originally Posted by Bob Fitz View Post
    You could also use a crosstab querry. See attached DB
    This was perfect--great and elegant solution.

    Dan

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You could also use a crosstab querry. See attached DB
    Even better! I so infrequently have situations in which to use them, they aren't my strong suit.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-12-2012, 07:38 PM
  2. Getting table/form content into generated emails using VBA
    By Monterey_Manzer in forum Programming
    Replies: 5
    Last Post: 06-18-2012, 12:54 PM
  3. Replies: 1
    Last Post: 04-30-2012, 07:52 PM
  4. table generated command button????
    By crabbymcdo in forum Forms
    Replies: 1
    Last Post: 06-24-2011, 04:11 AM
  5. From which query is the report generated
    By rukmal82 in forum Reports
    Replies: 6
    Last Post: 09-30-2009, 09:28 AM

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