Hi,
I am using the following code to populate a listbox:
strsql = "SELECT tblObservaties.AutoID, tblObservaties.Datum, tblObservaties.C_OntwVelden, [02_Ontwikkelthemas].Ontwikkelthema, [03_Generieke doelen].[Generiek doel], " _
& "[04_ObservatieItems].Omschrijving, tblObservaties.Alg, tblObservaties.C_GrF, [04_ObservatieItems].C_Gen_Doel, tblObservaties.C_Observatie " _
& "FROM tblSoortenOntwikkeling INNER JOIN ((((tblObservaties INNER JOIN 01_Ontwikkelvelden ON tblObservaties.C_OntwVelden = [01_Ontwikkelvelden].C_OntwVelden) " _
& "INNER JOIN 02_Ontwikkelthemas ON (tblObservaties.[C_OntwThema's] = [02_Ontwikkelthemas].[C_OntwThema's]) AND ([01_Ontwikkelvelden].C_OntwVelden = [02_Ontwikkelthemas].C_OntwVelden)) " _
& "INNER JOIN [03_Generieke doelen] ON ([01_Ontwikkelvelden].C_OntwVelden = [03_Generieke doelen].C_OntwVelden) " _
& "AND ([02_Ontwikkelthemas].[C_OntwThema's] = [03_Generieke doelen].[C_OntwThema's])) INNER JOIN 04_ObservatieItems ON (tblObservaties.C_Observatie = [04_ObservatieItems].C_Observatie) " _
& "AND ([01_Ontwikkelvelden].C_OntwVelden = [04_ObservatieItems].C_OntwVelden) AND ([02_Ontwikkelthemas].[C_OntwThema's] = [04_ObservatieItems].[C_OntwThema's]) " _
& "AND ([03_Generieke doelen].C_Gen_Doel = [04_ObservatieItems].C_Gen_Doel)) ON tblSoortenOntwikkeling.S_Ontw = [01_Ontwikkelvelden].S_Ontw " _
& "WHERE (((tblObservaties.Verantwoordelijke) = '" & GlbInitialen & "') " _
& "And ((tblObservaties.KleuterID) = '" & GlbKleuterID & "') " _
& "And ((tblObservaties.Schooljaar) = '" & GlbSchooljaarKort & "') " _
& "And ((tblObservaties.Graad) = '" & GlbGraad & "')) " _
& "ORDER BY [01_Ontwikkelvelden].S_Ontw_Sort, tblObservaties.NumDatum DESC , tblObservaties.C_Gen_Doel;"
'CopyTextToClipboard (strsql)
LstObservaties.RowSource = strsql
strsql = Empty
On the form, the data shown in the listbox is not sorted correctly after executing the above script.
If I look at the data source, so the query, they are correct.
I then have the option to click on a line in the list box so that the individual data is put back in the respective fields of the form to make any adjustments.
After this action I have the listbox filled again with the same procedure and then they will be correct.
What could be the reason for this?
You can clearly see the difference on the attached file
Your advice please.
Attached thumbnails
Wrong:
right: