How do I create a Macro to total four blocks to a fifth in a form?

I created a form for my daughter to enter invoices for her job at a towing company. They need a total of charges for charges of towing, labor, storage and mileage. Unfortunately, I attempted to write my first macro and now I’ve locked Libre Office and can’t find or delete the macro nor can I edit the database. Please help!!!

I’m just guessing, if your looking at "My macros &… Basic, window, just exit out. Or if in your macro’s, delete the one wanting you to fix it, or all if not needed.

Hello,

You seem to be presenting two questions here. The main question deals with totaling four fields in a form and the second question is about locking up the database. This should really be two different questions on the forum.

As for the second, to help there, more info would be necessary like what was in the macro, can you run in Safe Mode (found in Help menu item), does it only freeze when the macro is run and possibly more.

For your main question, you should avoid macros wherever possible. To get a total you only need to use a sub form and some SQL (query). Now the total will only be available once the record is added to the table but in 99% of the cases this is all that is needed. For some examples of this, see sample files in my answers on these posts:

Adding 6 Fields for Total but some fields will have no Data to Add

Base - calculations from calculated field

Refresh table control

Now, if you absolutely must see the total as the data is being entered, macro code is necessary. As you have probably noticed, this is not typically easy. What code is needed is specific to the form and conditions. Here is a link containing a sample of calculating fields as data is entered:

Base Form data uneditable

@curly1958 Only possible way to assist with Base file is if you could post it. If so, please no personal or confidential info. Otherwise, not sure what you did there - possible damage to it.

As for the form, if you know little or nothing about queries let alone macros, this is going to be a large task for you even with help. Learning curve for macros of this type is large.

You may want to peruse the Base docs found here → LibreOffice Base Handbook

Ratslinger, Thank You for your response. Yes, It would be “extremely” helpful to see the total as the form is the data is filled into the appropriate blocks. As for the use of a query versus a macro, it’s all greek to me. I can create forms and tables but anything further and I’m in deep trouble. Hence where I am now, the database won’t even open for me. Not even in “Safe Mode”

@curly1958 This is not an answer. When responding please use add a comment available below the answer you are responding to. If you need to improve your question, Edit it (lower right of question) and note the edited portion.