Link to home
Start Free TrialLog in
Avatar of rltomalin
rltomalinFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Subform does not refresh

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
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

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.
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.
Avatar of rltomalin

ASKER

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
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.
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
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.
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
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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