|
-
Jan 10th, 2002, 12:51 PM
#1
Thread Starter
Lively Member
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!
-
Jan 10th, 2002, 01:46 PM
#2
Try:
SELECT DISTINCT FieldName FROM TableName
Paul
-
Jan 10th, 2002, 02:14 PM
#3
Thread Starter
Lively Member
i'll try it...
Thanks a lot ill have to give it a try.
-
Jan 10th, 2002, 02:35 PM
#4
Thread Starter
Lively Member
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
-
Jan 10th, 2002, 02:44 PM
#5
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
-
Jan 10th, 2002, 02:47 PM
#6
Thread Starter
Lively Member
Ya i wasn't getting an problems with the SQL...I think ill try the post on the general board..thanks
-
Jan 10th, 2002, 02:57 PM
#7
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|