me.requery

unclefink

Registered User.
Local time
Today, 12:36
Joined
May 7, 2012
Messages
184
I know this has been asked in reference to various problems throughout this forum but I am unable to find a solution as to my issue.

I have a form that lists an individuals Fname, LName, DOB. On the top of this form, i have a drop down box that allows me the option to view a specific individuals information.

On this same form, i have a button which opens a new form to allow me to add new indviduals into the db.

The problems is this.

When i add a new person in the "Data entry" form and go back to the first form to view their data, its not in the drop down box until i push a "refresh form" button on the initial form. The next issue is that after i refresh the form only the combo box is populated by that new person, when i click on them detail data references that last person prior to entering the new person.

If i close and open the form entierly both the combo and detail section update.

I would like all the new data to populate the primary form without having to close and open it again.

Any help would be greatly appreciated.
 
Have a look at the post here.

As part of the event that you are using to open the form to add records you need to put in a line of code to requery the Combo;
Code:
Me![YourComboName].Requery
The line must be after the DoCmd.OpenForm line and it is important that the form that you are using to add items to the list is opened in acDialog as this pauses the code whilst that form is open and then resumes it (to requery the combo) once that form is closed.
 
John,

First of all I would like to thank you for taking the time to help me out with this. I've tried all sorts of combinations with no success.

I took a look at your post linked above and suspect those steps will fix the issue. The problem i'm having now is where do I place those lines of code. In the combo box properties or the form properties? I'm not too familiar with the coding part of this as im pretty new to access alltogether.

So i have a form that has that combination box which lists the record details based on the person I would like to see. If the person is not in that list, i click on a button attached to an embeded macro that opens the secondary form. Since the "event" is a macro, how would i introduce the "Me![YourComboName].Requery" into that process.

In reference to the acdialog, where would i find that setting?
 
The code needs to go in whatever event it is tha you are using to add items to table that forms the Row Source of your Combo.
 
I think i've gotten a majority of this completed but have a question regarding the second part of that link you sent.

Quoted from your other link

"I presume you have set up the combo with Limit to List = Yes

Then in it's On Not In List event put the following or similar;

Code:
MsgBox "Double-click this field to add an entry to the list."Response = acDataErrContinue
Then in the On Dbl Click event put the following;

Code:
Dim lngcombo7 As Long If IsNull(Me![YourComboName]) Then Me![YourComboName].Text = "" Else lngcombo7 = Me![YourComboName] Me![YourComboName] = Null End If DoCmd.OpenForm "FRM_NameOfFormToAddNewValue", , , , , acDialog Me![YourComboName].Requery If lngcombo7 <> 0 Then Me![YourComboName] = lngcombo7
FRM_NameOfFormToAddNewValue will be a form that allows the addtion of new values to your Lookup Table. "
__________________

For the double click event, which "Double click" property do i put that into. The "new subject form", the "combo box", or the form that I ultimately want to update with the drop down box?
 
The Double Click event is the Double Click event of the Combo.


As an aside when you post code if you use the Code wrapper (that's the highlighted button in the image below) you can format, your code, so that it is easier to read.

attachment.php
 

Attachments

  • Capture.PNG
    Capture.PNG
    16.1 KB · Views: 294

Users who are viewing this thread

Back
Top Bottom