Also Form Properties
| Events
| Before record action
is pointing to Standard.Confirm.BeforeRecordAction
but there is no code in Standard
.Confirm
. Suggest removing BeforeRecordAction
event from Form Properites
.
Note, to change Companies CompanyID to autoinc, you must first get rid of the CompanyID=0 value in the first record, as 0 is a special autoinc value used in SQL to mean set to next auto-inc value. Because you have constraint based relationships setup these need to be unhooked first, and then re-hooked after the IDs are manually edited, and the auto-inc is set to yes. You have to hand edit the Companies
, People
and Visits
tables and change CompanyID
from 0 to 4. Then re-hook relations.
At First, thank you very much for your suggestions!
1)Before I read your last comment, I changed the AutoValue by a more stupid way. I created a copy of my database to a different file, then deleted People and Visits tables. I changed to AutoValue and then reinserted the People and Visits from my backup database. I hope the result is the same.
2)As for the Boolean I changed it to Integer. Whatever the type it works normally. I had placed the Boolean because I saw it in an example.
Also I changed the name from ID to FilterID. I revised all form names to Filter, Form, Sub1, Sub2 and Renamed the List Box 1 to Companies List Box. Fianally, I deleted the macro from the events tab.
Now, as for the List Box, it’s in the right place. It must be to Main Form (Filter) in order to work.
Let’s close this one. Again, thank you very much for your suggestions.
UPDATED: Check this out. It’s my new improved version of this solution that I promised you.
@preks, if you think this is cool, please check the (approved answer) check mark to the left of the top of this answer to turn it green. Thanks.
Caveat: This method is however, for now, limited to small to reasonable sized tables only. Large tables, like those with well over 1000 records might not work very well as a brute force method is used to seek the selector’s record#. This is because LO is missing a function to use an index for record lookups. I’m hoping that this missing functionality can be added to LO at some point.
Make sure your REFRESH button is contained WITHIN the sub-form as shown in the FORM NAVIGATOR window (and NOT within the MainForm). That’s how it is in my setup, and I don’t get any message (such as “The content of the current form has been modified. Do you want to save your changes?”) when clicking the confirm/refresh button.
Thank you for your prompt reply. You are right, my refresh button is within the MainForm, one step higher of all SubForms. But I did this in order to refresh all 3 subforms when clicking the button. If I put it in one SubForm it will only refresh this SubForm (and the other two SubForms will keep showing previous records). How can I get over this?
My suspicion was correct. It is how your Forms/subforms are set up.
In MainForm
properties you have a macro (supposedly) pointed to in Events -> Before record action
. Delete this.
Next, the form (subform if you will) Form
is correctly under MainForm
. However, Subform
and Subform2
should actually be subsubForms in the subform Form
.
Here is what it should look like in Form Navigator:
With that change all the entries update with the one button clicked. Also see there is a dangling option button out there.
Ratslinger, you are genius.It worked as a charm indeed!
Haha, the option button is there on purpose. I put it as I could not find another way to stretch my bottom margin, so I put a non working tiny option button.
As for the macro, it was there forgotten, so I deleted it.
But now, how can I control if something is changed on my record before refreshing the form? The only solution is putting a macro? And if yes, is there a macro that has worked for you? And in which SubForm should I put it?
Macros are not for you - at least until you learn a great deal more. Form=Master; the other two are People & Visits. On the Master, add a button with an action of Save record
. If you make changes to Master click save record before any NEW selection with refresh button. For People & Visits (not all fields on these) any changes will be saved anytime you got to a different line in the grid. No button necessary for these. You can even add new entries for these two; going to a new line saves.
If this answers your question please click on the (upper left area of answer).
Well, I understood your solution but my problem is the opposite… Everything that is written, even by mistake, (or maybe someone erases data by mistake) is saved automatically on the record change. So I just would like to put a reminder before the record change to remind the user that somewhere he made changes. If he did on purpose he will click Yes and jump to next record. If not, he will click No, the changes will revert and he will jump to next record. This can only done with macro?
@preks The forum is set up to ask a question and (hopefully) get an answer which satisfies the question. Then people can search for their problem and possibly find an answer to their question. If different questions are presented and answered after the initial question, it gets buried. For no other reason, please ask this as a new question. It is actually a pretty good question.
That’s what I wrote in my initial question: “Of course I want this message to appear if I do some changes, but only when that happens, else it is irritating to appear all the time.”
We found the way to make it disappear totally (by giving it the correct structure), but that’s not what I asked in my first question.
Sorry I didn’t read it that way. Let me give it a bit of thought.
No, wait… I create a new question…
Thank you very much. Let’s close this one. You can find my next question on my profile!
@preks FYI - the message referred to in you question was actually related to a change made to the “Filter” table because the listbox had changed the value but the record was not updated yet when the refresh button was selected. Of course, when the button was moved to the correct position the message stopped. So the approach now must take on a whole different aspect. I write this only so you understand what was happening.
Oh, thank you very much. Nice to understand it.