Solved

Subform does not refresh

Posted on 2013-06-11
9
339 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
  • 5
  • 4
9 Comments
 
LVL 84
Comment Utility
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 84
Comment Utility
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
Comment Utility
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
 
LVL 84
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:rltomalin
Comment Utility
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 84
Comment Utility
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
Comment Utility
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 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
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
Comment Utility
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now