Results 1 to 2 of 2
  1. #1
    byterbit is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Oct 2010
    Location
    Noou Yauk
    Posts
    32

    No! Not THOSE records !

    Why are other codes coming in ? I explicitly said "V44" !


    The meter numbers are the same, but I just wanted to pull in those records in contacts where the code was V44; I'm getting many others as well.



    docmd.runsql "insert into v select DISTINCTROW t.* from t inner join contacts on t.meter = contacts.meter where contacts.code ='V44' "

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Without seeing some data, it is hard to say what the problem is. I sould start by creating a query using:

    Code:
    SELECT t.* FROM t INNER JOIN contacts ON t.meter = contacts.meter WHERE contacts.code ='V44'
    If that doesn't give the desired results, I would try:

    Code:
    SELECT DISTINCT t.* FROM t INNER JOIN contacts ON t.meter = contacts.meter WHERE contacts.code ='V44'   "
    Then try:

    Code:
    SELECT DISTINCTROW t.* FROM t INNER JOIN contacts ON t.meter = contacts.meter WHERE contacts.code ='V44'   "
    When the query returns the desired recordset, copy the SQL and paste it into your Insert code.

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

Similar Threads

  1. Date function to query records and Sum records
    By sullynivek in forum Queries
    Replies: 0
    Last Post: 04-05-2011, 08:37 AM
  2. Replies: 10
    Last Post: 01-10-2011, 07:52 PM
  3. Replies: 7
    Last Post: 10-20-2010, 04:08 PM
  4. Replies: 3
    Last Post: 03-25-2010, 12:31 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