Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 390
  • Last Modified:

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
0
rltomalin
Asked:
rltomalin
  • 5
  • 4
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
rltomalinAuthor Commented:
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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
rltomalinAuthor Commented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
rltomalinAuthor Commented:
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
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
rltomalinAuthor Commented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now