Select Invoice


The invoice system works almost as I hope. See example.

I like to start with InvoicesOverview, select an invoice and push the button to see the details.
So far so good, but I like to be able to use the prev next buttons as well.

How can I fix this?



After looking at the sample, if you want to go to previous or next records then your approach is incorrect.

What is needed is a Main Form and Sub Form linked. Have attached sample which combined you two forms into one and presents what you want. Form is InvoicesModified. No Macros needed at all.

Sample — SelectInvoice.odb

Yes, it can be done like this but with a large list of invoices this approach might get confusing.
It’s not possible with a separate form?


Much is possible when writing code. However I do not agree with your comment.

First, the selection is identical to your initial form - still a large list. So it seems if this modified form is confusing than so is your approach. They are both the same. It is just that you use two forms and code and this uses one form and no code. The grid has the next and previous buttons on there.

Don’t see the confusion but you can always use separate buttons assigned to Previous and Next actions (place on main form with grid).

Best part is no need for macros. Best to avoid whenever possible.

Agree to avoid macros. I already need one to print the invoice. Now another one to look at the details of the invoice. Maybe I should start from scratch again.

And the complete invoice system is far from finished. When creating a new invoice I want to select a customer from a list, then add prices and other stuff.

Coming from Filemaker I’m struggling with LibreOffice for about 4 years now.

You may also want to consider using a list box instead of a table grid. The user can get a quick selection by starting to type in the field.

Don’t know your situation. Just trying to offer some possibilities.

After searching quite a lot, the solution was quite ease. The magic code looks like this:


Now I can select a row in a grid, push a button and go to the form with all details from that record. But all records are available. Buttons with previous and next are still working


While oForm.absolute(n) may work for the time being in this particular situation, it is not a correct method. It does not guarantee the correct record wanted is actually obtained. The only reason it may work here for now is that there are no gaps. However if some records are deleted you may experience incorrect results.

Doing things correctly is not always easy.

@ Ratslinger

Since the grid is a list of invoices, I don’t see how I can link to a deleted invoice. For now this was the only solution that let me link to the invoice and still be able to browse through the rest.
I do want to do it correctly but I haven’t found one example that did what I wanted. But I’m still learning.


The preferred method is actually extract the data from the selected row. Here are a couple of posts with samples:

If you still have problems, may be best to post a new question with your sample and code.