Combo Box loses its value

I have a table control that contains a column that is a combo box that stores its values as integers. I have a macro that runs every time the form containing the table control is loaded or changes records that sets the combo box to a default value for the purpose of saving the user the time of selecting it. Unfortunately, the visible value for the default does not show up, and it can be manually selected, but when the record is submitted, there’s an error because that combo box field has been cleared of its value.

Edit: Per Ratslinger’s recommendation, I’m attaching the .odb file. It connects to a mySQL backend. Hopefully the fact that you won’t have access to the backend won’t inhibit determination of the problem’s source.Metrology.odb

Hello,

It is very difficult to determine your problem simply based upon what is posted. Not certain you are referring to a combo box or actually (more likely candidate) a list bot which can display an item and store something different.

It would be best if you could edit your question and post a sample of the Base file - no personal or confidential information. Please also note the OS and LO versions you are using.

Thanks! I can’t be certain it’s a combo box. (It’s options come from a SQL query, with the bound field being an integer id field.

@agerber85,

Being this is a MySQL DB and have no connection using the sample.

Please copy pertinent data/forms to an HSQLDB embedded Base file and post that.

Edit:

I can copy your forms but do not know which one you are talking about.

@Ratslinger,
Thanks for looking at this. I’m sorry for being the noob expecting someone to pull an answer out of the ether, and with no idea how to help you help me. Unfortunately, I’ve only learned what I needed to get by as I went about Base, MySQL, and macros, and I don’t know how to pull the data from the backend into an embedded.odb file.

@agerber85,

As you have MANY forms in this Base file, please tell me which one your are referring to. I am not about to start a big guessing game.

@Ratslinger,
Fair enough. It’s the form “Adding Measurement Data 3”, and the macro that autofills the value is “AddMeas_AutofillPersonnel”

@agerber85,

OK have the form. Table control has two list boxes - OPERATOR and EQUIPMENT. Do not know which you are referring to. Also, see nowhere the macro “AddMeas_AutofillPersonnel” is referred to. Could you be kind enough to point me to where this is run from?

@Ratslinger, Sorry, it’s OPERATOR. I had disabled the trigger on my end to prevent operators having problems here. I re-enabled it and re-uploaded the base file an hour ago. (The new file is Metrology_X.odb.)

@agerber85,

Triggers are part of the database (MySQL in this case) and no MySQL Base file alone will have this. May add more difficulty but please post this trigger definition.

Edit:

Just occurred to me. I don’t believe you mean a trigger but rather an event. Is that correct? Terminology is important.

Is there a straight-forward way to migrate the MySQL to HSQLDB and preserve these triggers? I must confess I’m a little blown away by the news that MySQL could contain references to LO macros in the frontend.

Sorry but I don’t think you understand and may not be reading all my messages. Don’t believe you are using triggers as it seems you don’t realize what they are.

Your Metrology_X.odb doesn’t seem to exist.

You can create a new HSQLDB embedded database and copy and paste items from the MySQL file to that one. Then post. What I have so far is not of much help as so much is missing.

Hello,

Shot in almost the dark.

Seen the macro and do not see the data committed. See this post → Base: How to change ListBox SelectedValue via LO Basic

Here is another → Default text or record in a listbox

Thanks! Darkness notwithstanding, you nailed the problem and the solution! Unfortunately, I hit another issue, where I’m overwriting existing records. I think I can prevent that with an if statement, but I don’t know how. I’ve asked another question getting at that.