Renumber a List

Bob. I have a command button which runs a macro. The macro runs the code which is a module. Does that make sense. I did try to run the code as a an event procedure from On Click But was having trouble. That aside I have re-looked at the requery and am getting "DoCmd.Requery" to work. Yes I was having trouble with incorrect data entry. Say moving the number to 7 typed 8 at first stage then typing 7 to replace the number instead of 8 again
 
The DoCmd.Requery is ok, but if you launch the function with a macro, you should do the requery with the same macro. Open the macro, and on the blank line below the function call, click the selection box, and you will find Requery is a selection. This way you do not need vba code.
Your next step (if you wish) is to design a form that does not need carefull entry to avoid duplicates. The design could also permit a block of entries to be processed with one click. The most complicated design would be to allow you to change several non consecutive entries with one click by tagging each entry with the new position, untill all entries are tagged, then process the changes in one step. That is very possible, but takes a lot of thought and desgin. There are several ways to accomplish that task.
Smiles
Bob
 
Done that okay. Yes I want to go to next step however before that, with the code I have I cannot see a way where I am simply deleting an entry from the list. I would have used a query on another Command Button to Open a Table used the record selector to delete record then go back to the code to renumber. Can code be written for this new button to open a form as a Datasheet to delete or ask for Special Number to be selected and then automatically renumber the following records. Bill
 
That is why I suggested a new form be designed. Access is a very powerful tool, but in that power comes an array of options. There are many, many ways to do the same thing in Access. So any suggestion I have, may or may not be the way you would like to do it. Myself, I am very good at using the help and reading the forums. I satisfy most of my requirements using VB code, and I tend to avoid macros. Simply because in a future release, the macro can change what it does, where my code will generally always work far into the future. With code, I can control the process, with a macro, it sometimes controls me....grrr...which I do not like. One of these days, I will get stuck and ask for help, but so far, so good......
I do not know your form, but, assuming it is record based, then when you have the record you wish to delete as the active/current record, that record can be easily deleted.
Add a command button, the command button wizard should pop up. In the categories, select Record Operations, and in the Actions, Select Delete Record, on the next page ... click text and enter Delete Current Record. That should give you a quick way to delete a record.
 
Bob.Working on Record Deletion setup. Would like to proceed with new form to that would allow easier entry of records. Also should I go back and try to get the code to work from a command button to avoid the Macro. I am going away on Saturday not returning home till Wednesday next week. That will give you a break. Wondering if I am allowed to continue this thread. Bill
 
Hi Bill,
The forum is a place where a question is asked and hopefully you can get an answer. Since you are learning, you have had a number of followup questions. I believe you have a fair start now, and if you believe designing a new form will improve your application. Feel free to continue with questions. I do strongly suggest you attempt to get a form working, using Access form design, Macros where applicable, or VB code to achieve your results. Use the Access help and don't be afraid to try it, debug it, try again, etc until it works. The best way to learn is to do it. Second suggestion is to step back and take some time to identify all the possible things you might want to do with your data, document that for yourself, then design one or more forms to perform those requirements. You may want one form for each action or one form with multiple actions available on that form.
Planning saves a ton of development time.
Smiles
Bob
 
Bob. Have already had pen and paper out looking at altering at least one table. Would like to proceed as follows if that is okay with you. I will try to get something in place to run the code and remove that macro. Also you said in post 42 where one does not need careful entry to avoid duplicates and that a block of entries could be processed with one click. Would like to get that in somehow. Do not see the need for more complicated Procedures, but will need some guidance for that. Bill
 
I am back to assumption mode. I assume you have a main form (Sections) and a subform Specials. The Subform is a continuous form or a datasheet. You want to be able to
1) add a special to the subform
2) delete a special from the subform
3) move a special from postion x to position y within this section
4) move a special from position x to position y within another section
5) move specials x to x+no from this section to position y to y+no in another section
6) after any activity (1-5) occurs, the specials in each affected section must have consecutive numbers from 1 to the end
There was a lot of gueswork in this. Please correct any errors.
Smiles
Bob
 
Form at present just a separate file outside database till I get what I wanted. Set as a Datasheet. This file is a complete prize list up to approx 560 entries. The sections I mentioned are not separated within this list. Eg the numbers 1 to 50 are for Yorkshire Canaries, 51 to 100 Norwich Canaries, 500 to 550 Lovebirds. Each year the National Federation awards two medals (one each in different Sections)and what I meant previously was, this year say they were for Yorkshires, next next year Norwich, next year next section and so on. What you have provided works. I can move Specials up and down the list. I can add and delete entries. Each operation is a little different and entering what number for each procedure which is taking a little time to come to grips with. I was thinking your thoughts may have been simplifying that and that multipule entries could be moved. Bill
 
Ok, so is this not the time to create a database?
EG:
Sections table
SectionID
Section Description
Section info
Srction National this year (Y/N)
Special table
Special SectionId
Special Prize Number
Special Prize Info
 
Last edited:
Yes it is a good time to new DB (or did you mean Table).Off for a few days need to look more closely at this when I get home.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom