Ask Your Question

Base: search button and showing the datas

asked 2018-12-16 17:41:00 +0200

Roby gravatar image

updated 2018-12-16 18:02:36 +0200

Hello everyone, I repost my question hopefully more detailed. I have a MS Access clients DB that I want to transfer to LO Base.
I start from zero in writing DB and codes, I think I did a lot of job connecting three tables (client's data, activity, membership history). And this is how it looks like on L.O.Base: LOBase database


I start to digit a last name in the SEARCH DROPDOWN BUTTON (which has yellow background), and it shows the various clients (alphabetical order, the dropdown can open if necessary, or can stay closed). Sorry, this is how the old MS database looks like:

search by last name

When I select the one that I'm interested to or press ENTER, it should retrieve all the datas and show below in table with the green background.

See pic 2

after pressing ENTER the datas appears in the table

I'm quite new to write codes and stuff, so I need help to set up a query or a macro that does that job. I also have the code of that search button which is in the old database (microsoft access). This is the code that I found on the MS Access, which is in the "Properties of the field", the command "After update":

Private Sub CercaCognome_AfterUpdate() ' Trova il record corrispondente al controllo Me.RecordsetClone.FindFirst "[IDCliente] = " & Me![CercaCognome] Me.Bookmark = Me.RecordsetClone.Bookmark End Sub

Thank you! Roby

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-12-16 18:22:16 +0200

Ratslinger gravatar image

updated 2018-12-18 06:18:19 +0200


The answer here is basically the same as in your original question posted here -> How to set up correctly a search dropdown button?.

The code you present in the question is only of interest with the original Access file. Little can be gotten from just that code.

As stated in the other answer, using a table filter will get you what you want without using any code (except for SQL). And as for SQL (Query), a sample (again mentioned in original post answer) would be needed to complete what is actually needed.

Screenshots do not help to get answers for this type of question. Depending on how the form is actually set up (internal form & sub forms), it may be just a matter of retrieving, through the table filter, the main record & the rest will display automatically.

Edited 2018-12-17:

Just to give another example, have copied your form (marked as revised) stripped most of the problems, added list box & button with a small macros. You can choose an item using the list box or all records using the push button.

Sample ---- ListBoxSelect.odb.

edit flag offensive delete link more


Hey Ratslinger, what can I post to help you and helping me? My LibreOffice is in Italian Language.... Can be this screenshot of Relationships of any help? image description

Roby gravatar imageRoby ( 2018-12-16 18:48:13 +0200 )edit

Back to basics - Use a table filter. Original question had a link to a description and how it works. I also included there a working sample. Seems you have three tables on this form. Clienti seems to be main form & that would be retrieved using SQL & table filter. The other two tables would be sub forms linked back to the main form. Again without a sample(.odb file without personal or confidential info) that is about all that can be done.

Ratslinger gravatar imageRatslinger ( 2018-12-16 19:00:31 +0200 )edit
Roby gravatar imageRoby ( 2018-12-16 19:17:32 +0200 )edit

Sorry but that sample simply crashes any time I try accessing the 'Tables' section. Of no value.

Ratslinger gravatar imageRatslinger ( 2018-12-16 19:40:08 +0200 )edit

Also, there are two list boxes. Which one are you trying to select from? Do you need both?

Ratslinger gravatar imageRatslinger ( 2018-12-16 20:04:07 +0200 )edit

There are two ways to do this. As mentioned previously, use a table filter. This needs no macros and you should be able to do this based upon the already provided info & sample in other question. The other is to write a custom macro. If you are not able to write your own code you are going to run into the same problem you have now - presenting code to someone else to fix and not knowing how it works. You should learn table filtering and use that.

As mentioned above, there is a problem with the sample provided. Additionally, the list boxes for selection are NOT to be on the same form as the rest of the data. They are not actually part of the record being looked for. And then there is the question on the one or two list boxes needed.

As stated a number of times ...(more)

Ratslinger gravatar imageRatslinger ( 2018-12-17 02:09:05 +0200 )edit

C:\fakepath\DB Test for help.odb I try again. I kept 6 clients with creative and imaginary datas. Hope it works. The Form I will use mainly is "frm_ANAGRAFICA_CLIENTI" Anyway thank you for your support

Roby gravatar imageRoby ( 2018-12-17 16:24:09 +0200 )edit

@Roby The new file still crashes each time I attempt to access the Tables section or Relationships. Try downloading yourself and see what I am experiencing.

Ratslinger gravatar imageRatslinger ( 2018-12-17 18:00:45 +0200 )edit

I tried, and it crashes too... :( I don't know what to do, so I try this and that to see what it works... I'm watching these videos but It seems I cannot apply to my need. I'm going crazy! It should be very easy to digit a surname in the yellow box and the data appears the the green part, but it's not?!?!?

Roby gravatar imageRoby ( 2018-12-17 18:50:48 +0200 )edit

@Roby You are obviously having multiple problems. Selecting from a list box & having data appear in the form is a relatively simple process. Have already given you samples of this & a link to instructions but you don't seem to use these. You haven't even been able to get me a sample so I can demonstrate how to do this using your form.

I will now attempt to duplicate (it will not be exact) what you seem to have and add the selection process. This will be time consuming and cannot say how soon an answer will come. But this seems to be the only approach you are wanting as what I have given you so far doesn't seem acceptable to you.

Ratslinger gravatar imageRatslinger ( 2018-12-17 19:04:30 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-12-16 17:41:00 +0200

Seen: 160 times

Last updated: Dec 18 '18