I created a Form to access and edit records in an MySQL table. See photo:
I explain. It is the catalog of my personal library. The form was created with the form wizard, then modified.
The top half draws from a Query, so it is read only. Fields like “Autor” (author) or “Género” (Genre) are internally numeric, pointing to other tables that contain the text. The query does the searching and displaying the texts. This part works wholly, AFAICS. It can not create a new record, it is read only.
The bottom part (the subform in the wizard) draws from the books Table and is R/W. Some fields are drop lists doing the text lookup for fields like author or genre. All the editing works, AFAICS. However, the problem is that when I click “new record” (I have first to go to the last record in the top half, then click in the bottom half, then click the button in the tool bar below), a new empty record is created, but can not be saved because the Index field is not autoincremented, thus it contains a duplicate number (the Index field displays <AutoField>"
and not a newly created index number; I can not edit the number directly, either). On save record I get this error:
Error inserting the new record /home/abuild/rpmbuild/BUILD/libreoffice-7.3.6.2/connectivity/source/commontools/dbtools.cxx:747
Duplicate entry '374' for key 'PRIMARY' /home/abuild/rpmbuild/BUILD/libreoffice-7.3.6.2/connectivity/source/drivers/mysqlc/mysqlc_general.cxx:119
I can, though, create the new record directly in the table or using a different form (that has different issues), and then edit the record in this form, and save it.
(I have a similar form (my previous step) in which both top and bottom parts pull from the Books table (thus the top part displays ID numbers for fields such as author or genre), in which I can create new records, but obviously the top part is not useful, using numbers for names)
Do you know what is wrong, or how can I solve or bypass this issue? Thanks.
I am using openSUSE Linux Leap 15.3.
Regarding LO Base, I’m almost a novice.
If you need more information, please ask.
Version: 7.3.6.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 12; OS: Linux 5.3; UI render: default; VCL: gtk3
Locale: es-ES (en_US.UTF-8); UI: en-US
Calc: threaded