Way to know form name that opens a particular form

We dont know which the form name called formC... since formC is opened from combobox. And my topic goal is to know this form name...
So is the problem you can't get frmFootprint to open? or it opens but you don't know which form opened it? or both?

My suggestion solves the 2nd problem, I don't get an issue with opening the form using the 'edit' button as you identified on post #1

Edit: and when frmFootprint is closed, the calling combo is updated anyway. so I still don't see what you are trying to achieve. I thought perhaps all the other forms that might be open than use that combo, but then you said in post #14 in response to Unc's question

you can have many forms open- Not really, one at time ex: (B1A1 open, B2A2 closed) or visa versa
 
Last edited:
We dont know which the form name called formC... since formC is opened from combobox. And my topic goal is to know this form name...

Does it require extra work from user? User must to enter a wrong item to trigger NotInList event?
No. The user must enter an item that is not in the list, hence the name of the event.
That is carried over to the data entry form, so you are making life easier for them, not harder.
 
So if you open FormC in dialog mode, you need to close that to get back to the calling form and then requery the combo?
Yes, it is exactly what i want.
 
So is the problem you can't get frmFootprint to open? or it opens but you don't know which form opened it? or both?
My suggestion solves the 2nd problem, I don't get an issue with opening the form

It is 2nd problem, I dont know which form opened it (formC)?
 
I can't set form OpenArg of formC since it is opeing from combobox click.
The calling form knows itself => Me

When using this reference, it doesn't matter if there are multiple instances of the same form as the main form, or if the form is currently being used as a subform. Me sure is selfish.

You can't pass a reference to an object using OpenArgs, this argument only takes and passes strings. But that doesn't matter. OpenArgs is a universal standard property for simple cases. In better cases, you create an OWN property in the FormC form.
Code:
Private m_ctlCallingForm As Access.Form

Public Property Get CallingForm() As Access.Form
    Set CallingForm = m_ctlCallingForm
End Property

Public Property Set CallingForm(ctlCallingForm As Access.Form)
    Set m_ctlCallingForm = ctlCallingForm
End Property

When you open the form, you pass the reference to the property, like...
Code:
DoCmd.OpenForm "FormC", ...
Set Forms("FormC").CallingForm = Me

When exiting the form, the requery can then be called:
Code:
CallingForm.Controls("Cbx_Footprint").Requery
(untested)
 
Last edited:
When you open the form, you pass the reference to the property, like...
Code:
DoCmd.OpenForm "FormC", ...
Set Forms("FormC").CallingForm = Me
I not opening formC from command_button thus now where to add this code
 
I didn't write anything about a command button. But somehow the form is opened by code. There then now by two-line.
With an open form then only the property assignment.
 
I didn't write anything about a command button. But somehow the form is opened by code. There then now by two-line.
With an open form then only the property assignment.
It opens by clicking on "Edit List Item" of combobox.... I dont see where to add the code
 
It opens by clicking on "Edit List Item" of combobox.... I dont see where to add the code
Use the double click event?
I have never used Edit List Items, never even knew it existed on right click. :)
Set a tempvar to the form name when you load the form. Then Activate that form.

Now we know why it seems so complicated, you are not using events. :(
 
I attached the sample db here, for easy evaluate the issue
Example.png
 

Attachments

Use the double click event?
I have never used Edit List Items, never even knew it existed on right click. :)
Requery on the GotFocus event of the form?
 
Use the double click event?
I have never used Edit List Items, never even knew it existed on right click. :)
Set a tempvar to the form name when you load the form. Then Activate that form.

Now we know why it seems so complicated, you are not using events. :(
No event, so cant set tempvar
 
No event, so cant set tempvar
You are telling me you have never heard of the Form_Load event?
Set a Tempvar (CurrentForm) on every form load, then activate/open that form.

Or just use an event like everyone else does? :(
 
Seems 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
 
edit: oops wrote this late last night, forgot to hit post. Posting to show NIL event.

I'm a little confused. It looks to me that you are using a value list for your combo.
I don't think a requery will make a difference.

If your combo is table based you can use the NotInList event to add items to the list. You can keep other combos current by adding a requery in the on enter event of the combo.

Here's example Not In List events in a couple of flavors.
 

Attachments

Last edited:

Users who are viewing this thread

Back
Top Bottom