Solved

Subform does not refresh

Posted on 2013-06-11
9
350 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
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 84
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
 
LVL 84
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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 84
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 84

Accepted Solution

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

895 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

14 Experts available now in Live!

Get 1:1 Help Now