26. december 2002 - 11:42Der er
25 kommentarer og 1 løsning
Data mellem to lister
Hej.
Er totalt nybegynder indenfor access men har alligevel kastet mig ud i et projekt! men jeg sider fast!
Jeg har i en formular lavet to lister hvor den ene får sine data fra en tabel! Det var så meningen at jeg skulle kunne vælge nogle af disse dataer ud sådan at når jeg klikede på et navn skulle det blive sendt over i liste2!
mr.j>You are going to need either a new table conatining those selcted OR an extra field in the existing table which is used for marking those which are selected.
when you double click on one of the names in the first list you either set the extra field to True and then refresh the form. The first list only selects those where th extra field is false and the second list only selects those where the field is true.
Jack, if you want to put them in a combo on another form then wouldnt it be best if you had a check box field on the first form then those which are selected (checked) get shown in the next form (combo)? This way you dont need to show then in another list!
Yes I have received the file. I may have been too quick there about using a checkbox, I dont think its possible to display a checkbox in a list. I'll do it as you wanted first so you can see how it works.
I have sent the dB backto you, hope it can be of use.
This is for other users. New field added to table named Selected when a record is double clicked I updated the field to either true or false. When I open the form I set them all to false to make sure they are all in the first list.
and here is the code for the form.
Option Compare Database
Private Sub Form_Load() DoCmd.RunSQL "UPDATE test SET Selected = 0 " Me.Refresh
End Sub
Private Sub lstKunder_DblClick(Cancel As Integer)
DoCmd.RunSQL "UPDATE test SET Selected = -1 WHERE [Leverandør ID] = " & Me.lstKunder Me.Refresh
End Sub
Private Sub LstSelected_DblClick(Cancel As Integer)
DoCmd.RunSQL "UPDATE test SET Selected = 0 WHERE [Leverandør ID] = " & Me.LstSelected Me.Refresh
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.