FoxProProgrammer
Programmer
I'm sure that this is a simple issue, but I'm new to Access and couldn't find an answer in the Help.
I am developing a form that tracks the calibration history of equipment. The form displays three fields from the "calibration" table in a three column combo box (last cal date, next cal date, and cal report number). The calibration table (child) is related to the "serial number" table (parent) through a foreign key. The form has a button that the user presses to add new calibration data to the database. When the user presses the "Add" button, a new form is presented where the user enters the last cal date, next cal date, and cal report number. The user then presses the "Save" button on the Add form, the data is saved, and the Add form closes.
At this point, the combo box needs to be updated to include the new record that was entered. I can't figure out a way to get the combo box to execute the query again without closing the form and reopening it. That is not a good solution. I tried setting the RowSource to the query string in the Form "On Got Focus" event, but that doesn't work. In fact, this procedure doesn't even run when the focus changes from the Add form to the form with the combo box. So, I have two questions:
1. Why isn't my On Got Focus procedure running when the Add form closes and the form with the combo box gets the focus?
2. How do I force the combo box to do the query without closing and opening the form? If I could get the On Got Focus procedure to run, my solution might work...but I'm not sure if resetting the RowSource will cause the query to execute.
Thanks for your assistance.
dz
I am developing a form that tracks the calibration history of equipment. The form displays three fields from the "calibration" table in a three column combo box (last cal date, next cal date, and cal report number). The calibration table (child) is related to the "serial number" table (parent) through a foreign key. The form has a button that the user presses to add new calibration data to the database. When the user presses the "Add" button, a new form is presented where the user enters the last cal date, next cal date, and cal report number. The user then presses the "Save" button on the Add form, the data is saved, and the Add form closes.
At this point, the combo box needs to be updated to include the new record that was entered. I can't figure out a way to get the combo box to execute the query again without closing the form and reopening it. That is not a good solution. I tried setting the RowSource to the query string in the Form "On Got Focus" event, but that doesn't work. In fact, this procedure doesn't even run when the focus changes from the Add form to the form with the combo box. So, I have two questions:
1. Why isn't my On Got Focus procedure running when the Add form closes and the form with the combo box gets the focus?
2. How do I force the combo box to do the query without closing and opening the form? If I could get the On Got Focus procedure to run, my solution might work...but I'm not sure if resetting the RowSource will cause the query to execute.
Thanks for your assistance.
dz