Results 1 to 7 of 7

Thread: Soring records

  1. #1

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827

    Soring records

    I am trying to sort the records in table by using SQL statement or the "recordset.sort" property of data control.

    For SQL:

    VB Code:
    1. Data1.RecordSource = "Select * from Customers order by CompanyName Asc"
    It gives me an error message saying "jet databse engine could not find the object 'select *...'

    For data control:

    VB Code:
    1. Data1.RecordSet.Sort = "ComapnyName"
    Is that how you sort the records or there is some other way to do it?
    Baaaaaaaaah

  2. #2
    Member
    Join Date
    Sep 2001
    Location
    USA
    Posts
    33
    why don't you try getting the SQL query into a recordset and then setting the source to the recordset? I think it's problem is that the query is not an actual thing that it can link it to.

  3. #3

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    How do I do that then?
    Baaaaaaaaah

  4. #4
    Member
    Join Date
    Sep 2001
    Location
    USA
    Posts
    33
    I'm not sure about the exact code (I still have to look up most things!) but it's something like this:

    VB Code:
    1. Dim rs as new Recordset
    2.  
    3. rs = "Select * from Customers order by CompanyName Asc"
    4.  
    5. data1.recordsource = rs

    again I'm not sure about the exact code

  5. #5

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    I does not work
    Baaaaaaaaah

  6. #6
    Member
    Join Date
    Sep 2001
    Location
    USA
    Posts
    33
    same error?

  7. #7

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    "Invalid use of property" error on line:

    rs = "Select * from Customers order by CompanyName Asc"
    Baaaaaaaaah

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