2 part issue (1 Viewer)

woohoo30ca

New member
Local time
Yesterday, 21:20
Joined
Sep 18, 2013
Messages
6
I have a form with subforms. On one of the subforms, I've added an onclick event.

With the code below, I'm wanting to open up a Companies form filtered to the value that is selected of the CompanyName field within the subform


DoCmd.OpenForm "frmCompanies", , , "frmCompanies.txtFormCompanyName = '" & Me.txtCompanyName & "'"


The two problems are
1. Even though I click on a company name in the subform (and I can see the name of the company during debug - find in me.txtCompanyName) I get an input box to enter the name of the company -- I thought the value in Me.txtCompanyName should be passed automatically

2. second issue is even if I type in the company name in the input box that displays, the form Companies opens up, but I'm dumped to the first record in the database - no filtering occurs.

I tried changing around to
DoCmd.OpenForm "frmCompanies", , , "txtFormCompanyName = '" & Me.txtCompanyName & "'"

no difference. I am running Access 2007 incase there's structure difference if this helps. :confused:

the "txtFormCompanyName" is the name of the textbox control on the frmCompanies. This is also the paramater that is being requested in reference to my point #1
 
Last edited:

woohoo30ca

New member
Local time
Yesterday, 21:20
Joined
Sep 18, 2013
Messages
6
Got it. I had to put the field of the record source in, I was putting in the name of the field from the form I was trying to call :eek:
 

Users who are viewing this thread

Top Bottom