Avatar of Peter Groves
Peter Groves

asked on 

Refresh subform after record added from called form!

Not sure how I would post code so I'll try exlains what I need as best I can!

I have a Navigation form with a data entry form selected. So NAVFORM2 has a networkinfo form active.

The networlinfo form also has a subform called notes1 in continuous  mode to show scrolling  notes.

I have a command  button on the networkinfo form to add new notes. ( This opens a new form addnote thats adds a note then closes)
Everything works fine but I'd like to refresh the  notes section when I add a new note is added.
Can't quite figure out how to do it yet!

The only way to see the newly added note now is to click on the navigation panel to open the networkinfo form again!

Thanks

Pete
Microsoft AccessVBA

Avatar of undefined
Last Comment
PatHartman
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

<This opens a new form addnote thats adds a note then closes>
refresh or requery the subform after adding the record from the form or before closing the form "addnote"

you can also move focus to the subform by
docmd.browseto acbrowsetoform, "notes1","NAVFORM2.NavigationSubform"
Avatar of Peter Groves
Peter Groves

ASKER

I've tried top do the refresh but I keep getting a 2465 error! I'm probably not formulating the
command properly!

This part here   >>    docmd.browseto acbrowsetoform, "notes1","NAVFORM2.NavigationSubform"


 I would put just before docmd.close on the addnote form!  
That would set the focus to the subform. but where do I put the refresh or requery?

or
It would help if I was sure how to formulate the requery on the subform note1

So just before the docmd.close I could

Form!navform2.form.networlinfo.form.note1.requery  ( What would be the correct way of writing this?)


Thanks

Pete
upload a copy of the db
Avatar of Peter Groves
Peter Groves

ASKER

Unfortunalely, I can't because of security constraints!  

But it would be very basic anyways !

from the button on the  networkinfo form  I do DoCmd.OpenForm "notes1"

The Notes1 form adds a new note!  Then I was doing docmd.close to go back the the networkinfo form!

Pete
can you just illustrate your navigation form- subforms or post an image here..

try any of these

DoCmd.BrowseTo acBrowseToForm, "note1", "NAVFORM2.NavigationSubform>networkinfo.NavigationSubform"

or

DoCmd.BrowseTo acBrowseToForm, "note1", "NAVFORM2.NavigationSubform!networkinfo.NavigationSubform"

or

DoCmd.BrowseTo acBrowseToForm, "note1", "NAVFORM2.NavigationSubform.networkinfo.NavigationSubform"
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Peter Groves
Peter Groves

ASKER

Since this aspect of the application is low priority, I had to concentrate on the main application. I used the navigation form to save time, but I`ll probably go with a main form and do the navigation myself as Pat suggests. However I'll still give this a go later this week!

thanks

Pete
<The problem is that experts don't use the Navigation form> NOT TRUE.
Avatar of PatHartman
PatHartman
Flag of United States of America image

I answered the question.  Please review  42049892.  One of the problems that people have with the navigation form is failing to understand that it uses one and only one subform and depending on what tab you activate, loads the appropriate subform.  People assume that they have to reference the object name of the subform rather than the name of the subform control.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo