Ask Your Question
1

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

asked 2018-06-26 13:21:43 +0200

curly1958 gravatar image

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!!!!

edit retag flag offensive close merge delete

Comments

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.

Mark McLean gravatar imageMark McLean ( 2018-06-26 15:12:56 +0200 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2018-06-26 17:33:55 +0200

Ratslinger gravatar image

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

edit flag offensive delete link more

Comments

@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.

Ratslinger gravatar imageRatslinger ( 2018-06-26 20:25:53 +0200 )edit

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

Ratslinger gravatar imageRatslinger ( 2018-06-26 20:26:53 +0200 )edit
0

answered 2018-06-26 20:16:05 +0200

curly1958 gravatar image

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"

edit flag offensive delete link more

Comments

@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.

Ratslinger gravatar imageRatslinger ( 2018-06-26 20:21:28 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-06-26 13:21:43 +0200

Seen: 48 times

Last updated: Jun 26 '18