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.

AHAXtremeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

0
AHAXtremeAuthor Commented:
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.

0
Malik1947Commented:
what is the error you're getting ?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

AHAXtremeAuthor Commented:
Can you please send what it should be so I don't spend time replicating what didn't work.
0
Jeffrey CoachmanMIS LiasonCommented:
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
0
AHAXtremeAuthor Commented:
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
0
Jeffrey CoachmanMIS LiasonCommented:
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
0
AHAXtremeAuthor Commented:
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.

0
Jeffrey CoachmanMIS LiasonCommented:
AHAXtreme,

Then try it in this format:

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

JeffCoachman
0
AHAXtremeAuthor Commented:
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.
0
Jeffrey CoachmanMIS LiasonCommented:
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
0
AHAXtremeAuthor Commented:
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.
0
Jeffrey CoachmanMIS LiasonCommented:
AHAXtreme,

<In addition what you had me download has no combo boxes on it.>
Yes it does.
If you open frmCustomersMain you will see it is a form that contains a subform
On that subform is a "combobox" to select the shipper.
(my suform is in datasheet view so the combobox is not visible until you actually enter that field.)
If you enter a shipper that is not in the list, it will notify you, then ask if you want to add it.
If you say yes, then it will "automatically", (without having to double-click), open a popup form so you can add this new shipper to the list.
You enter a new shipper into the popup form, then close the popup form, and the new shipper is "automatically" added AND selected in the combobox on the subform.
Which sounds to me to be exactly what you are looking for:
"You enter data into a popup form and that data is updated in the subform combobox"

Can you re-open my sample and verify this?

Notes:
1. I don't use the "Double Click" activate method, because it just adds one more un-needed, and possibly dangerous, step.
(from a user interface point of view, comboboxes are rarely double-clicked)

2. If you look at my code there is no "Save" command anywhere. That's because records added to any Access table are "Saved" automatically when you either leave the record or close the Table/Form.
Is there a reason why you are trying to force an explicit save?
Trying to force a save might be why you can't get it to work.

3. To make this system more flexible (so it could possibly work anywhere you want), the name of the new "Item" is stored in a public variable that is defined in Module1.

4. Most of the Microsoft Access Database templates have similar "Double-click to add" code.
Inventory Management, for example.
If you need to enter a new category, you can double-click the category combo box to add it. (Even in this MS code, there is no explicit "Save" command)

So re-visit my sample and let me know if I was on track or not
;-)

Let me know

JeffCoachman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AHAXtremeAuthor Commented:
Thanks I got it and am sure this will work. Thanks you very much.
0
AHAXtremeAuthor Commented:
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.
0
Jeffrey CoachmanMIS LiasonCommented:
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

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.