Topic: Edit record with multiple Comboboxes on the form.

Hello. Health and peace to all.
I would like to know if there is any example on the forum that helps me because I am not finding it.

1. In my project I used 5 comboboxes to register the code of the tests that the patients did.

2. When I click on show record, all comboboxes receive the first code, even if I have filled in 1 or 2 comboboxes.

3. Thus, the fields with the description of the exams are also not filled.

4. I tried to create a form edit but the problem remains.
The image shows the editing form.

Thnks a lot.

(by google translator)

Post's attachments

Attachment icon edit.jpg 169.13 kb, 105 downloads since 2020-06-25 

Re: Edit record with multiple Comboboxes on the form.

What I need is that it looks like this, as in the image, when editing the record.

Post's attachments

Attachment icon edit1.jpg 202.51 kb, 111 downloads since 2020-06-25 

Re: Edit record with multiple Comboboxes on the form.

Hi Lejoso,
Can you attach your project?
Derek.

Re: Edit record with multiple Comboboxes on the form.

Hello Derek, how are you?
I'm using MySQL, can I send you the dump?
Thanks

Re: Edit record with multiple Comboboxes on the form.

Hi Lejoso,
I think just the application (minus the .exe) will be okay.
Derek.

Re: Edit record with multiple Comboboxes on the form.

Hi Derek.
Here it is.
I tried several ways but none worked as I need.
Thanks for helping.

Post's attachments

Attachment icon EPC.zip 370.21 kb, 244 downloads since 2020-06-25 

7 (edited by derek 2020-06-25 17:20:46)

Re: Edit record with multiple Comboboxes on the form.

Olá Lejoso,
Obviously I don't have your data (because it's MySQL) but I believe the problem is the way you have defined the foreignkeys for the comboboxes on frmedit.
Please have a look at the attached screenshots.
1. Screenshot 1: this is corrrect for frmedit.combobox1.
2. Screenshot 2: this shows that frmedit.combobox2 has been set up using the same foreignkey as frmeditcombobox1 (ep.id_tuss) which is incorrect.  This is why the same value is showing 5 times in all comboboxes - they have all been set up using ep.id_tuss..
3. Screenshot 3: this shows the foreign key that you should be using in frmeditcombobox2 (ep.id_tuss1, not ep.id_tuss).
So you also need to change the other comboboxes to use foreignkeys ep.id_tuss2, ep.id_tuss3 and ep.id_tuss4.
You will also need to make the same changes in form epcad.
In Screenshot4, this is just a very easy way to show the additional fields in the 'tuss' table by concatenating them as part of the comboboxes rather than having to write extra sql calls in your script (but it may be that you prefer to design it as you have done - I just mention this for information in case you have not seen this done before).
Also, one other thing I did notice is that on form ep, ep.button1 (novo) calls a 'show form' rather than 'new record'.  I'm not sure why you want to do that.
Hope this fixes your problem,
Derek.

Post's attachments

Attachment icon lejoso.zip 934.79 kb, 260 downloads since 2020-06-25 

Re: Edit record with multiple Comboboxes on the form.

Thank you very much for your patience, Derek.
I will put your suggestions into practice. I think it will be all right.
Thanks a lot!