- Local time
- Today, 19:09
- Joined
- Jul 9, 2003
- Messages
- 17,071
Private Sub Form_Close()
If InStr(Me.OpenArgs, "FrmA1") Then
Forms.FrmB1.Form.FrmA1.Form.Cbx_Footprint.Requery
ElseIf InStr(Me.OpenArgs, "FrmB1") Then
Forms.FrmB1.Cbx_Footprint.Requery
End If
End Sub
If it's undocumented then it's just another silly thing they missed, lucky me I did not read any documentation, I debugged the app with the Locals window and the OpenArgs had that information. Lots of undocumented behavior comes from debugging.First, I looked up the ListItemsEditForm property. It says nothing about having an automatic OpenArgs tie-in
What happened in your test?So if there WAS an open args entry, it was done manually and that means from the call that invoked the form.
On my end, if you call the form from the subform's combobox edit button, the parent form's combobox does not show the last entered value. So it does require a requery.I'm with Uncle Gizmo in that the provided sample database works perfectly fine.
What happened in your test?
That makes no sense. Use Me.Name to put the form name in the OpenArgsI can't set form OpenArg of formC since it is opeing from combobox click.
Hi CJSeems my suggestion has been totally ignored. Not going to waste any more of my time so going to drop off this thread. Good luck finding an alternative solution
I dont know why it is not working at my side. Seem Edgar can replicate the issue.I tested the sample database you provided, and as far as I can tell it works in The Manner that you want it to. See attached see YouTube video for my demo of it working correctly. "your sample database!"
tblFootPrint Combo Box Matching
Pat, @Babycat is opening the form through the ListItemsEditForm functionality of the form, a property viewed in the Data tab of the form.That makes no sense. Use Me.Name to put the form name in the OpenArgs
I disagree with "reason" being enough test. As Carl Sagan says in his speech about Man in his arrogance "Common sense intuition can be mistaken, our preferences don't count".Once I read the documentation, if it doesn't tell me that it explicitly adds an OpenArgs reference, I don't make assumptions, and I don't have time to test things for which there are easier solutions anyway. Our time is limited and if I waste my time following a line of programming that is more convoluted than is really necessary, I do a disservice to the others I might later have the chance to help. So... What test would that be, Edgar? How about the test of reason?
Hi The Doc ManSo you DO NOT CARE how form C got called and you don't care whether A or B called C or you ran C directly for some reason. Put the combobox.Requery in the _Activate event for each of A and B. At worst, this causes 1 extra .Requery when you open the form for its first use. AND if you were to directly open C (for testing, e.g.) it doesn't have to look for something that wasn't there in the first place.
So your solution is to ignore it completely rather than asking for clarification. This is post 56 for a problem that was solved in post #2Really sorry for that, I have tried to understand your suggestion but I was not sure i understand it hence I dont know how to implement it
In fact, many proposed solutions. I was also missed Edgar solution about using OpenArgs until he makes "clearly nice pictures" to point out what I missed, his solution make me learn new things.So your solution is to ignore it completely rather than asking for clarification. This is post 56 for a problem that was solved in post #2
Public Sub RequeryOpenObjects()
Dim frm As Variant
Dim ctl As Control
Dim ctlSub As Control
On Error Resume Next
For Each frm In CurrentProject.AllForms
If CurrentProject.AllForms(frm.Name).IsLoaded Then
For Each ctl In Forms(frm.Name).Controls
Select Case TypeName(ctl)
Case "ComboBox", "ListBox"
ctl.Requery
Case "Subform"
For Each ctlSub In ctl.Form.Controls
If TypeName(ctlSub) = "ComboBox" Or TypeName(ctlSub) = "ListBox" Then
ctlSub.Requery
End If
Next
Case Else
'do nothing
End Select
Next
End If
Next
End Sub