Drag & Drop in continuous form

  • Thread starter Thread starter Lon3
  • Start date Start date
L

Lon3

Guest
Hello ppl,

I have a database for selling items.

In my opinion there are actualy 3 solutions to fix this. As i will explain later on.
But first i will try to describe the database first.

there is a reciept part and a "offerte" (<--in dutch) part. I cant remember the word anymore.

Everything is working fine. But i have got just one problem. I have a continuous subform with records in it. When adding records they get added at the end of the record set. Ok fine.... thats still no problem.

But if some item is forgotten. They will need to add it. But it will be added at the end of the list. and for example it needs to be between record 2 and 3.

So this is the problem. Is it posible to have it moved. For example with 2 buttons "Move Up" "Move Down" or drag and drop. I actualy don't care how this will hapen. but the items need to have the posibility to be reordered.

I found a interesting example database. with a listbox with the records in it. and drag and drop possibilities. But i cant figure out how to update this recordset order to the continuous form (it is the same query they pik). Or maybe to send the recordset in the listbox directly to an report would do the job either.

I would appriciate some help here. I am looking for a solution for 2 weeks already. and you ppl are my last hope.

Bye


Lon3,
 
Hi Lon3 ...

I am not an expert Access user and programmer, but it seems that the algorithm for this procedure is fairly straightforward.

You define a new field (call it sortkey) which is initially defined in order from 1 to 'no of records in set'.

Now, suppose we are currently positioned at record no 6 (also sortkey = 6). We wish to move it one up (or back). All we need to do is swap sort key 6 for sort key 5. So now record 6 has sort key 5 and record 5 has sort key 6. Next, we sort the records by field 'sortkey' and ... hey presto ... it is done.

I KNOW this can be done in Access ... it is just that with my Access skills, it would take me a day or two to realise ... and it is time that I haven't got :( ... however ...

... I have done it in Excel :) (attached ... it took about 20 minutes ... and you can examine the code in VBA), which I AM relatively proficient at. With respect to the Excel doc, start by using the Initialise button. The Move Up and Down buttons are plain navigation, the Change Up and Down are the buttons that do the job you want. Note that you CAN add records to the end of the set.

I hope all this is of some use to you or someone else ... I have enjoyed the mental stimulation :D
 

Attachments

Users who are viewing this thread

Back
Top Bottom