Pass Through from One form to Another Form Help?

smorisch

New member
Local time
Today, 15:19
Joined
Oct 14, 2015
Messages
4
Hi and thanks for taking a moment to read this question.

Access Version - MS Access 2010
Code - VBA

Here's the issue:

1 Form - frmWorkOrders
2 Form - frmAddCus
3 Form - NavigationForm

Both - frmAddCus and frmWorkOrders are SubForms Inside the NavigationForm.

In frmWorkOrders [Cus_Account_Name] is a LookUp field and I saw a video of someone processing the vba to pass information from one form to another even with a LookUp field as the target destination.

Fields of concern:
Cus_Account_Name (frmAddCus and frmWorkorders)

I need to Pass the text input from Customer_Account_Name from frmAddCus to Cus_Account_Name in frmWorkorder

I'm using a Close button on frmAddCus to process the Pass-Through in the OnClick Event.

Code I'm trying to pass with:

Private Sub Cmd_AddNew_CloseForm_Click()
Me.Refresh
If IsNull([Cus_Account_Name]) Then
'do nothing
Else
Forms![NavigationForm].Form.[frmWorkOrders].Form.Cus_Account_Name = Me.Cus_ID
Forms![NavigationForm].Form.[frmWorkOrders].Form.Cus_Account_Name.SetFocus

End If
DoCmd.Close
End Sub

Most common Error - 2465 - Microsoft can't find the "|1" you referenced.

I haven't referenced a "|1" anywhere :)

Not sure what I'm missing but it's becoming very annoying.

Your help is appreciated.

Thank you!
 
1. Are you sure the name of the control on the target sub form is Cus_Account_Name?

2. Are you sure that the name of the sub form control (not the actual form) is called frmWorkOrder, and not SubForm1 or similar?

I'd normally not go through the open forms collection by using, say
Code:
 Me.Parent!sfTargetSubform!Cus_Account_Name
 
Thanks So Much!

The Field Name on the subform - frmWorkOrders is [Cus_Account_Name] and the only Control I'm using on the frmWorkOrders form relevant to this process is the "Add" Control.

Yes, the SubForm is named frmWorkOrders, I checked this to be sure - In Properties under SubReport/SubForm it stays frmWorkOrders.. The odd thing is, when I select the frmAddCus form, the SubForm still says frmWorkOrders. I've not used navigation forms before, preferred switchboards, but I'm learning now :)

So, in Navigation Forms does one only have the option of naming one subform? I ask because when I attempted to change the name under frmAddCus, it stayed frmAddCus when I selected frmWorkOrders. hummm..

LOL.. I like building websites better...

Thanks for your assistance.
 
I was able to get the information to pass through the form!!! :)

Now I just need the AutoFill to work again..

Have a great night and Thanks!
 

Users who are viewing this thread

Back
Top Bottom