Sorting fields in Access 
Author Message
 Sorting fields in Access

Hi, all friends:

I have a access database, and i have  fields call first name and last name in customer table. This name is not sorting in the table.

My question is how can i sorting them by first name follow by last name and put in to a combox in the Visual Basic?  How should i coding this using VB?

Thank you in advance.

Hongwei



Mon, 23 Sep 2002 03:00:00 GMT  
 Sorting fields in Access

You could look at SQL for either the 'ORDER BY' or the 'GROUP BY' clauses.

Here's what you'd do for vb, for VBScript it'd be different because of the declarations.

dim strSQL as string, rs as ADODB.Recordset
set rs = new ADODB.Recordset

strSQL = "SELECT * FROM tblUsers ORDER BY [First Name], [Last Name]"
rs.open strSQL, "ODBC-DSN"
do while not rs.eof
    combo1.additem rs![First Name] & " " & rs![Last Name]
    rs.movenext
loop

  Hi, all friends:

  I have a access database, and i have  fields call first name and last name in customer table. This name is not sorting in the table.

  My question is how can i sorting them by first name follow by last name and put in to a combox in the Visual Basic?  How should i coding this using VB?

  Thank you in advance.

  Hongwei



Fri, 18 Oct 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Sorting fields in Access

2. Sorting fields in Access

3. Sorting fields in Access

4. VB4: Sorting an Access Data Base Field - How???

5. SQL Server Field Descriptions and Microsoft Access Field Descriptions

6. Accessing the autonumber field in access

7. Accessing empty/null Memo Fields in a Access 97

8. Sort order - Edit Filter Sort or Quick Sort

9. Sorting an Access table to improve access from SQL (despite the use of an index)

10. Sort question on two fields

11. Sorting Report Fields w/Code

12. Sorting Lookup Field via Code

 

 
Powered by phpBB® Forum Software