Macro to open an existing form (1 Viewer)

noelcass

New member
Local time
Today, 17:01
Joined
Nov 4, 2015
Messages
3
I am trying to do a database to retain the details of all my family relationships with each and everyone’s personal details like birth date, place of birth, parents, marriage date, place of marriage, education level, educational degree/s, death date, place of death, any known medical history, etc. This data will then be used to populate my genealogy software.
I have made some tables, one of these retains all the personal details, another one for cities in my country, another one for cities in other countries and countries in the world. These tables are linked accordingly.
As an input form for personal details, the end-user has to input his/her details. Needless to say, when a person resides in my country, I introduced a combo box that refers to cities in my country and the user will select the city accordingly (Malta is a small country so there aren’t a lot of cities). This does solve the problem completely. Thus I would like to have a command button that launches a macro that opens the “cities in my country form” and the user introduces the new city if this is not already in the list of cities. As one can deduce, it is practically impossible to use the same reasoning and methodology for relatives who were born in overseas cities. I thought that the easiest way was to create another command button and run a macro to open the “other cities in other countries” form, let the user input the new city and select the desired country.
I am using Access 2010 running under Windows 10 32-bit. A screen grab is attached.
Appreciate your assistance.
 

Attachments

  • Macro query.jpg
    Macro query.jpg
    92.5 KB · Views: 114

BitsOfBytes

Registered User.
Local time
Today, 11:01
Joined
Apr 14, 2015
Messages
15
You can do this:

-Combo box on your form with all the Malta Cities
-Create a form that allows you to add a city to your [cities in my country] table. On that form include a 'Done' command button. Go to the command button's properties=>events=>add 'on click' event to close the form and an additional event for 'requery'. For the requery control name choose your Malta City Combo Box
-On your main form create a command button next to Malta City combo box labeled 'Add City'
-Go to the command button's properties=>events=>add 'on click' event for 'open form' and choose your 'Add City' form you just made and set the data mode to 'New'

When you click 'Add City' it opens the form allowing you to add a city to that table. When you click done after adding the city it requeries your city box adding the new city to the list.

You can do the same for the 'Cities in Other Countries'

Alternatively you could create a table [TblLocation] with an ID, Country and City field. On your form you could have a combo box to select Country and the choices would be a query of countries in your [TblLocation]. Set the default value of that combo box to 'Malta' since most people are from there. Then create a second query to populate your city combo box. This could be done by querying your TblLocation, where country equals your country selected in your country combo box.

See attached sample I made.
 

Attachments

  • Location.accdb
    704 KB · Views: 99
Last edited:

noelcass

New member
Local time
Today, 17:01
Joined
Nov 4, 2015
Messages
3
Noted with great thanks

Ciao
Noel
 

Users who are viewing this thread

Top Bottom