Results 1 to 4 of 4
  1. #1
    Buakaw is offline Absolute novice
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    112

    Need help figuring out stuff

    In a project I'm working on (not done by me), I'm going through all the queries to see what they do, and to document them one by one to learn how everything works together.

    The SQL code for the query is this:



    INSERT INTO tblResponses ( QstnID, RspnsID, Rspns )
    SELECT DISTINCTROW tblQuestions.QstnID, [Forms]![frmSurveyResponses]![RspnsID] AS RspnsID, tblQuestions.RspnsDefault
    FROM tblQuestions
    WHERE (((tblQuestions.SrvID)=[Forms]![frmSurveyResponses]![cboSrvID]));

    I'm very new to this, and I can understand basically that this query is inserting a record into the table tblResponses (it's probably being called by someone else, or some VB code), and also selecting some fields from tblQuestions.

    Questions:
    1) I have not come across the syntax [Forms]![frmSurveyResponses]![RspnsID]. Where can I read up more about this? I'm guessing this is reading some data from a form named 'frmSurveResponses' and a field named 'RspnsID'?

    2) There is an equality test for [Forms]![frmSurveyResponses]![cboSrvID]. Ok, so I go and open up the form named frmSurveyResponses, but how do I locate which control is "cboSrvID"? How do I search for this field and it's identification?

    3) The 'Insert' command in the SQL code above does not have any 'Values' that follow. So what is it inserting?


    Thanks!

  2. #2
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    http://techonthenet.com/access/tutor...s/basics01.php
    http://word.mvps.org/faqs/macrosvba/...csIn15Mins.htm

    The links above should help.

    In SQL when you use INSERT INTO or just INTO, you are putting data into a new table.
    So 'tblResponses' is the new table name, and ( QstnID, RspnsID, Rspns ) are the fields that have been selected to be added to that new table.

  3. #3
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by Rixxe View Post
    In SQL when you use INSERT INTO or just INTO, you are putting data into a new table.
    In Access, INSERT INTO indicates an append operation, which inserts into an existing table, not a new one.

    Quote Originally Posted by Rixxe View Post
    So 'tblResponses' is the new table name, and ( QstnID, RspnsID, Rspns ) are the fields that have been selected to be added to that new table.
    tblQuestions.QstnID, [Forms]![frmSurveyResponses]![RspnsID], tblQuestions.RspnsDefault are the fields being inserted in the table. the field specs in parenthesis are the target fields for the append operation. they are NOT what's being appended.

  4. #4
    Rixxe is offline Blessed Bear
    Windows 7 Access 2007
    Join Date
    Sep 2010
    Location
    London (Essex ... yep!)
    Posts
    184
    Quote Originally Posted by ajetrumpet View Post
    In Access, INSERT INTO indicates an append operation, which inserts into an existing table, not a new one.



    tblQuestions.QstnID, [Forms]![frmSurveyResponses]![RspnsID], tblQuestions.RspnsDefault are the fields being inserted in the table. the field specs in parenthesis are the target fields for the append operation. they are NOT what's being appended.

    It appears that SQL server and Access are different in those cases..

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

Similar Threads

  1. Simple stuff
    By gdemets in forum Queries
    Replies: 5
    Last Post: 12-09-2010, 09:25 AM
  2. Replies: 2
    Last Post: 05-27-2009, 08:47 PM
  3. Access Simple Stuff, help
    By clwclw in forum Access
    Replies: 1
    Last Post: 05-02-2009, 03:10 PM
  4. I need help with weird stuff happening on a DB
    By makotoshishio in forum Access
    Replies: 9
    Last Post: 04-02-2009, 12:20 PM
  5. Quick way to stuff field names into text field
    By kfinpgh in forum Programming
    Replies: 0
    Last Post: 01-04-2007, 01:13 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