LIST BOX - He doesn't order

Ok I understand, I actually hadn’t thought about it.
I’ll try to see what I can do.
Thank you all, you are an inspiration.

Sorry TIM, one last question, I went to the CellPressed event, and I can capture the click event on the column but not on the title line. Where am I wrong? I need to click the name of the column header to then proceed with the sorting.

Immagine

HeaderPressed to order columns?

Yes, the HeaderPressed event is what I use. You have to remember which way the column is sorted n order to reverse it next time. In PaintHeaderContent I also draw the little arrows in the header cell for the user. And then I just call the method to load the ListBox.

In HeaderPressed I also do:

me.HasHeader = False                // Force the headers to be repainted
me.HasHeader = True

But perhaps these days there is a better way to do that.

I managed to click on the title and set the filter and sorting based on the Total column in the query, but the sorting it gives me is always wrong.
Better that I leave RowComparision with the sorting I did, at least it works :slight_smile:

Are your database values numbers or strings? I couldn’t exacty tell from the thread. At one point you said “stored as decimal numbers”. You mean as strings?

1 Like

Worst: how get it them back ? As String, as Double ? Aren’t they stored as currency ?

Looks like they are stored as strings in the database too. :frowning:
If so, no benefit to doing in the query after all.
So much guesswork here.

If they’re stored as strings in the database, then one could still get them properly sorted by suitably amending the ORDER BY, but this should not have been necessary.

But this whole thread has been made more complicated than it need have been because of an unsuitable database design.

1 Like

No, the access database field is integer with decimals, so numeric, as far as currency is concerned.

Unfortunately, the database is this one and it’s been full of data since 2008, I’m trying to fix it as best as I can, and get correct information.
In addition, I’m switching little by little from my good old VB6 to Xojo, and in addition to learning I practice like this, and thanks to your advice I can slowly get to a solution. Many times, not being a professional programmer, certain reasoning and certain information are difficult for me to understand, that’s all.

The Access user manual is a bit vague on the Field Types (Access Field Types)

Frederico, you do not help with that sentence:
No, the access database field is integer with decimals, so numeric, as far as currency is concerned.

As far as I can tell, Currency is a valid Access Field Type, the one you were supposed to originaloly use. The two other Field Types “Number” and “Large Number” means nothing to me: are they integer, float, double, etc. ?

Now, we all know the difference between what we must use and what we really use (when we start, but not only) once the result is correct.

I nearly forget: because in SQLite you can get the values as StringValue or IntegerValue or (DateTimeValue, read the screen shot below for the whole list)… disclosing this information is also important.

This list comes from the Autocomplete feature ‘cause I do not foundit elsewhere !

If you need the data stored in one of these types, in DatabaseRow (read), use:
BlobValue, BooleanValue, CurrencyValue, DateTiimeValue, DoubleValue, Int64Value, IntegerValue, NativeValue (?), PictureValue, and StringValue.

There is a list under the Variant name. But no specific use is shared. Something like “These list of variant are Data base specific. See DatabaseRow for details.” is missing, IMHO.

Lost ? Use it and… love it.

ok

SQLite supports Blob, Integer, Text, and Real (64-bit floats) or Null. That’s all.

Integer can vary from 0 bytes to 8 bytes, depending on size of integer. Text is a string of any length, either UTF-8 or UTF-16. Blob is any collection of bytes.

For more info, see:

https://www.sqlite.org/datatype3.html

and (in particular section 2.1):

https://www.sqlite.org/fileformat.html

1 Like

The quote you made are dta that comes from Xojo’s IDE (watch the screen shot above).

My entry was to say what Field Types Access have and what SQLite can do.

And you forget a lot of Datatypes that SQLite support. Read Datatypes in SQLite

Why are you quoting back to me a link I quoted to you?

If you still have access, why not open the table in design mode and take a screenshot of the fields and types, then paste it here?
Like this:

(ignore the big arrows, which are someone else’s )

Sure.
I’ll see if I have Access at home and do it. We’ll update soon.

If you have not got Access at home try this free tool that allows you to examine Access data files. Its free and i have used it a lot in a recent ACCESS front end conversion, a job that is still ongoing. Can be a bit clunky in places but works well and has a small footprint and requires no installation.

MDB Plus, MDB Viewer Plus - Open and edit MDB/Accdb files.

1 Like

thanks !!

The field being sorted is of type CURRENCY