Prob with SQL

K

KRISH

Hi!

Dim db As DAO.Database
Dim rs As DAO.Recordset

Dim mystr(100) As String
Dim myint As Integer
Dim str1 As String

Dim ctr As Control

Set db = CurrentDb
Set rs = db.OpenRecordset("Select distinctrow
[Category] from [Payments];")

MsgBox str1
With rs
If Not (.EOF And .BOF) Then
.MoveFirst
myint = 1
Do While Not .EOF
mystr(myint) = ![Category]
str1 = str1 & "; " & mystr(myint)
.MoveNext
myint = myint + 1
Loop
End If
End With

MsgBox str1
str1 = ""
'MsgBox db
rs.Close
db.Close

In the above syntax rs (recordset) is fetching all records
in payments table. I need only unique records. Please help
what is wrong in it. Thanks for your help.

Krish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top