Results 1 to 7 of 7

Thread: Selection with no duplicates

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Posts
    117

    Selection with no duplicates

    Was wandering what the simple sql statement/setting is to select records from Access and if there was a field with the same value as another it would not select it.
    So if your list was AABBCDDD what you select is only ABCD

    Thanks for the help!

  2. #2
    PWNettle
    Guest
    Try:

    SELECT DISTINCT FieldName FROM TableName


    Paul

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Posts
    117

    i'll try it...

    Thanks a lot ill have to give it a try.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Posts
    117

    Smile on more quicky...

    Ok, trying to test out the select method and to set a datacombo attributes and running into a problem.
    The code I'm trying to use is:
    Set s_list = New ADODB.Recordset
    s_list.Open "select distinct state from rainfall_data", states, adOpenStatic, adLockOptimistic

    txt_state.RowSource = s_list
    txt_state.ListField = s_list.Fields("state")
    txt_state.ReFill

    It gives me an error with txt_state.RowSource = s_list saying that the rowsource method or data member is not found? huh?

    I can go set it/see it when I am looking at the form so why can I not code it in?

    Again, thanks for the help

  5. #5
    PWNettle
    Guest
    I'm sorry, I can't really help with data controls and I'm not sure what the problem is that you're experiencing. You might try a new post to see if you get more replies.

    I can assure you that

    SELECT DISTINCT FieldName FROM TableName

    is valid SQL though.

    Good luck,
    Paul

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2002
    Posts
    117
    Ya i wasn't getting an problems with the SQL...I think ill try the post on the general board..thanks

  7. #7
    Hyperactive Member
    Join Date
    Sep 2001
    Location
    St. Albans, Herts, UK
    Posts
    259
    As you have started with recordsets created in code, why bother with data controls. Just fill your combo using code.
    Graham, www.gab2001uk.com VBExplorer Forum Moderator VBExplorer
    www.gab2001uk.com For comparing and contrasting DAO with ADO
    Code for Creating, Copying, Compacting, Replicating, Synchronising Access 97/2000 databases plus showing Schemas and using .Seek

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width