Order By

skate

Registered User.
Local time
Today, 06:43
Joined
May 22, 2002
Messages
136
does this piece of code make sense to anyone?

Me!lstResults.RowSource = "ORDER BY Files!Proposal DESC"

I have a button that is supposed to sort the values in the list, but it doesn't seem to work.
 
Skate,

There is obviously something missing from the statement - normally you would expect to see something like:-

Me!lstResults.RowSource = SQLstr & " ORDER BY ...."

or possiblly Me!lstResults.RowSource = Me!lstResults.RowSource & " ORDER BY..."

I think the last one would be a bit dicey though if you pressed the command button twice.

Check around the code and see if they are building an SQL string that the ORDER BY statement should be appended to.

I haven't seen the Files! bit before so I don't know about that. One of the other guys might be able to tell you if its valid - if not, and Proposal is a field on your form, try Me!Proposal.
 
skate:

Peter is right you are missing something.

Me!lstResults.RowSource = "ORDER BY Files!Proposal DESC"

1) You're populating a listbox
2) The RowSource is missing something in its SQL

You can try to find an old backup copy that will have the
appropriate SQL

or

See how many columns in "lstResults"
See what table "Proposal" is in
Set Me!lstResults.RowSource equal to something like:
Select a, b, c
From TheTable
Order by Proposal Desc

I hope you find a backup.

Wayne
 

Users who are viewing this thread

Back
Top Bottom