Link to home
Start Free TrialLog in
Avatar of AHAXtreme
AHAXtreme

asked on

MSAccess Form requerying data of another form when closing a popup form.

I have a primary form that if you double click on a drop down it opens a popup form to enter data in another table. When I hit save on the popup form I need it to requery the info on the subform of the primary form so the entered data displays in the subforms drop down.

Avatar of Malik1947
Malik1947

in the code of the save button use the requery method of that subform.

Avatar of AHAXtreme

ASKER

I tried to create the requery for the subform on the save button but got compile errors. I am asking what the correct code to use is.

what is the error you're getting ?
Can you please send what it should be so I don't spend time replicating what didn't work.
Avatar of Jeffrey Coachman
AHAXtreme,

Malik1947 was just asking for the error, they were not asking you to "Replicate" anything.
:)

<Can you please send what it should be >
Well, if you are getting "Compile" errors then there is probably something amiss in your code, that's why Malik1947 asked.
You never presented us with the code you tried. (it might just be a simple fix)
Besides, we can't "send what it should be" unless you provide all the object names.
Make sense?
;)

Anyway...
If you want a generic string, try something like:
    Forms![YourMainForm]![YourSubForm].Form![YourComboBox].Requery

This will requery a combobox on a subform.

JeffCoachman
Well actually you did send what it should be via the example you just gave but your example gives the error Microsoft Access Can't find the field frmAlarmLocationJoin referred to in your expression.

Your example

Forms![YourMainForm]![YourSubForm].Form![YourComboBox].Requery

My Revision

Forms![frmMetrodialReviewEdit]![frmAlarmLocationJoin].Form![signalDescriptionID].Requery

Towards the bottom you will see a combo box called Signal Description when you double click on it a popup comes up to be able to enter new field descriptions.

I need the save button on the popup to save the subforms on the primary form so the combo boxe lists refresh their data.
SubformRequeryScreenCapture.doc
AHAXtreme,

It shold be fairly straightforward, unless the combobox is is on a "sub-sub" form.
From here the easiest thing to do would be to post your db to :
www.ee-stuff.com
You can remove any sensitive data. But leave enough to see the issue.
Zip the db and then post.

I/we will have a look at it and make any suggestions

JeffCoachman
The combo box that needs to be refreshed is on a sub form. I can't post the database on any site regardless of removing the data. It's a high security facility so they won't let me do this.

Does anyone know as per the initial question how to requery com combo boxes on a subform.

Let's define this better.

I double click on the primary form and a popup form comes up. I edit the fields on the popup form than when clicking save I want all the combo boxes on sub forms to a primary form to be refreshed.

AHAXtreme,

Then try it in this format:

Forms![YourMainForm]![YourSubForm]![YourComboBox].Requery

JeffCoachman
This works if I put it behind the save of the main form in which the sub forms reside but not if I put it behind the save of a separate popup form that is disassociated from the main form.

Please advise.
AHAXtreme,

Here is an actual working sample of a combobox being requeried on a subform:

    https://filedb.experts-exchange.com/incoming/ee-stuff/6839-Access--EEQ23133795RequeryRefre.zip

Examine the way it works, and all the code it contains.

Try and duplicate what I have done, in your Database.

JeffCoachman
I'm not sure what I'm saying that isn't being understood.

You have a sub form on your form but what if you have a popup in order to enter more contacts or company names for a combo box to populate. Than how can you make the save on the popup persistently refresh the data on the subform and most preferably the individual combo box

Let's break it down

The primary form and the sub form have double clickable combo boxes which bring up popup forms.

For example:

Double click on company name combo box and the Company name list popup form comes up
Double click on the address list popup form and the address popup form comes up.

Than I would enter new data into the popup than when clicking save it would very definately either that one combo box or the entire sub form.

In addition what you had me download has no combo boxes on it.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks I got it and am sure this will work. Thanks you very much.
What puts the value from the combo box into the correct field of the popup form.
I type the value in the message comes up
I click Yes than the popup comes up but the value I entered into the combo box isn't in the popup field.
I have to type it into the field than is shows up in the combo box and the drop down appropriately.
AHAXtreme,

<What puts the value from the combo box into the correct field of the popup form>
When the NotInlist Code fires, I am storing the "NewData" string in a Public Variable called: strpubNewData
I am inserting this value into the popup form on the open event:
...Me.txtCompanyName = strpubNewData

The variable is declared in Module1

JeffCoachman