Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Subform does not refresh

Posted on 2013-06-11
9
Medium Priority
?
386 Views
Last Modified: 2013-06-12
Hello Experts
I have so very nearly got this working, but have one final problem.

In the attached test db - on switchboard.
Click Maintenance
Click New Group
Create a new contact (uses frmNewGroup and frmAddMainContactToListFromNewGroup)
When the new group is created, the subform to display the contact details is displayed fine.

Now do the same with Edit Group.
Select a group
Create a new contact (uses frmEditGroup and frmAddMainContactToListFromEditGroup)
The subform is not refreshed.
As far as I can see, both situations use identical code.  I cannot see what is wrong.

As an aside.  I have locked the application down for the user (so menus are not shown etc.)  
I have just realised that, when opening the application in that mode, the icon for creating a new record from the list is not displayed.  I have to Allow Full Menus, Allow Default Shorcut Menus and Allow Built-in Toolbars to activate the icon.  But if I do this all the development menus are displayed.  Any suggestions on that?

Best regards

Richard
Minibus-database---EE-110613.mdb
0
Comment
Question by:rltomalin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 85
ID: 39237345
I can't follow your instructions.

When I click Maintenance and then (I assume) Groups, I click New Group. I enter a Name for the Group and click Save. At that point, I don't know how to "Create a new contact" - do just enter a new name, or select an existing name?

Also, if i open tblGroups I see the Group I added, but it doesn't appear on your listing when I select Maintenance - Groups.- View/edit a Group. You need to modify your qrySelectAllGroupsForEdit to include a LEFT JOIN between the two tables. This will show all groups regardless of whether they have a Contact or Not. In fact, given that this is simply a listing of Groups I don't see why you need the Contact table at all for that form.

Please provide more specific instructions regarding how to create a New Contact.
0
 
LVL 85
ID: 39237367
Followup:

Are you using the "Allow Value List Edits" feature in 2007 (with a .mdb-formatted database, no less)? It seems that you are, but it's difficult to say, as I don't quite follow the flow of work in your application.
0
 

Author Comment

by:rltomalin
ID: 39237380
Hi There

Yes.  I have enabled Allow Value Lists, so that when creating a new Group (or editing one) the user can create a new contact for the group from the drop down list.
Sorry for not being a bit clearer.  When I said create a new contact, I meant from the icon at the bottom of the ComboBox listing.

Hope that is a bit clearer.

Regards

Richard
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 85
ID: 39237585
Okay - I see what you're reporting.

If I add a New Contact to a New Group, then the data I enter - like the Address, Email, etc - is displayed. If a add a New Contact to and Existing Group, the data does not appear. I have to re-select that new Contact in order to see the data.

I'm not sure why one method would work, but the other would not. My first suggestion would be to play around with the Requery calls (take them out temporarily, for example) and see if you can get the refresh to succeed.
0
 

Author Comment

by:rltomalin
ID: 39237609
Yes - you describe it exactly.  I have tried lots of messing about with the code but cannot seem to figure it out.
But I will try a bit more.

In th emeantime, if you or someone else can figure it out I would be obliged.

Regards

Richard
0
 
LVL 85
ID: 39237667
Your application is somewhat "messy", so it's sort of hard to pinpoint exactly what the issue is. You have multiple, identical forms that perform very similar tasks (like your Edit vs New forms), so it would take quite a bit of time to sort something like this out.

You might be able to force a refresh and then use the bookmark method, from your AddNew forms. You'd do this in (perhaps) the Quit button:

Forms!frmEditGroup!MainContactDetails.Form.Requery
Dim rst As DAO.Recordset
Set rst = Forms!frmEditGroup!MainContactDetails.Form.RecordsetClone

rst.FindFirst "ContactID=" &Me.ContactID

If not rst.NoMatch Then
  Forms!frmEditGroup!MainContactDetails.Form.Bookmark = rst.Bookmark
End If

This is generally the way to "force" a form to show a record - but since you're working with Dialog form (the Add and Edit contact forms are Dialog), I"m not sure how that will work.
0
 

Author Comment

by:rltomalin
ID: 39237818
Hi LSM

I tried your code to replace the Forms!frmEditGroup!MainContactDetails.Form.Requery statement in the Add contact form.  But it didn't seem to make any difference.

I have played around a bit more and find that if I make the frmEditGroup into a new record form (by setting Data Entry property to Yes), then it works fine.  (this is the only difference I could find between the two forms.)

But that doesn't really get me much further because I still can't see how to solve the problem.

Regards

Richard
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1500 total points
ID: 39238652
From my view it's time to "back up and punt" as we say.

In other words, include code to show your Add New Record forms without using the built in Access methods, which means you can handle much more of the data movement. I can't go into details right now, but it would involve the NotInList methods discussed in the earlier links.
0
 

Author Closing Comment

by:rltomalin
ID: 39240557
I intend to work on creating a simpler example of the problem and re-submit.
It may well be that in doing this the problem will uncover itself.

Regards

Richard
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question