Macro which auto fill form #BASE

Good Night people.
My ask is about auto fill in forms, for example if I have a costumer who have a profile in my base, and I wold to save a new sell to him, I wold like, when I put her name into the form, other informations auto fill, like code poste and the city where he lives. I Would only need, put into the form the item, wich he bought. Or another example, if I have a table, wich I have my products and its codes. I would like, when I write the code in the subform, autocomplete the others fields into de subform, for example the name of the product, or some information wich I have in that table.
Can someone help me?

Macros should be avoided whenever possible. Many times they are not necessary. Have attached sample which uses a list box and a table filter to select the wanted company. Two forms are included. One without a macro which after selection requires you to press the button to retrieve the customer. The second form uses a very small macro to automatically retrieve the customer from the selection without a button.

This type of situation can easily be adopted to your requirements.

Sample: SelectCompanyByFilter2.odb

If this answers your question please click on the :heavy_check_mark: (upper left area of answer).


I saw this forum over here and I have the same question, but I am using a MAC OS 2011. I downloaded the file above, it is work on MAC, but I tried to repeat the same commands but it is not working. (I tried to use the form with no macro).

Nothing happens when select button is clicked.

I don’t have enough Karma to upload my file.

Thank you.

Hello Victor, First do not use Wiki for posting. Second, do not ask a question as an answer. Answers are to respond to the original question. Use comments. Now as you state the downloaded sample works so you must not have set something correctly. Check the following. Make sure the filter table is in place and set correctly. Make sure you have internal forms set correctly (sample has three). Make sure Button is on the SubForm not the MainForm. Continued →

Make sure Button property for Action is set to Refresh form. If after all of this you are still having a problem, post a NEW question stating your problem with what is happening and also refer to this original question.

Thank you for your answer. SOrry about the misunderstood how to use this forum.