Select unique record

yn19832

Registered User.
Local time
Today, 13:50
Joined
Mar 8, 2007
Messages
26
Thanks in advance for your help.
I have an Access database and the record is like this:

Date Country Type Index
1.1 Canada A
2.1 Canada A
3.1 Canada A
4.1 Canada A
5.1 Canada A
6.1 Canada A
1.1 US A
2.1 US A
3.1 US A
4.1 US A
5.1 US A
6.1 US A
......
How can I select the unique country names from the database?
 
SELECT DISTINCT Country
FROM TableName
 
Many thanks. Now I would like to fill an array with the country name, the codes are as following, but there is problem with "varArray(i) = rec("Country")"

strSELECT = "SELECT DISTINCT Country"
strFROM = " FROM tblIndex "
strSQL = strSELECT & strFROM
Set rec = db.OpenRecordset(strSQL, dbOpenDynaset)
rec.MoveLast
rec.MoveFirst

ReDim varArray(1 To rec.RecordCount)

i = 1
Do While Not rec.EOF
varArray(i) = rec("Country")
rec.MoveNext
i = i + 1
Loop
 

Users who are viewing this thread

Back
Top Bottom