Thursday, 1 August 2013

Access Databases

It's been a while since I posted due to the inevitable nose to the grind the end of the academic year brings.

However, I'm now on the other side of that particular war zone and have a new problem on my hands. It's a ridiculously simple one, but this is my first Access 2010 experience and the Macro/ Expressions/ Code setup is messing with my understanding of this database.

So, I have a master form on which is contained a drop down table of Providers. There is a button to add a new Provider if the one required is not on the list. The button opens a form using a macro which is prepared to Add a new entry into the Provider table.

So far, so good.

There is a "close" button on the Add a New Provider form, which closes the form using a macro. However, on returning to the master form, the combo box of Providers has not updated.

Now, I have tried a number of things but what finally worked was adding a Requery event to the onClose event of the second form.

So, make sure you are looking at the Properties of the Form. Go to onClose. Choose "Code" builder. In the VB window type:


This will add the new value to the Combo Box. I haven't found a way to get a Macro to do this (yet).

The other thing I want to achieve is that as the second form is closed, the combo box has automatically selected the new Provider that has just been added to the Provider table.

This, which seems to me to be a basic common sense function, is causing me some serious problems.


No comments:

Post a Comment