Access Sub Form list rowsource issue:

V

Vinod

Hi All,

I've created a form which will be used as sub form in another form (main
form).
Sub form contains Country, Product_Name, Emp_Name fields (unbound form) and
a list box (multi column).

ListBox rowsource = "Select Nz([Country]," ") AS [Country Name],
Nz(Product_Name," "), Nz(Emp_Name," ") From tblProducts Where (Nz([Country],"
") Like nz([Forms]![frmSub]![Country] & "*","*") And Nz(Product_Name," ")
Like nz([Forms]![frmSub]![Product_Name] & "*","*") And Nz(Emp_Name," ") Like
nz([Forms]![frmSub]![Emp_Name] & "*","*"))

i.e., when user selects any country name the list box displays corresponding
records and the same for Product_Name, Emp_Name fields.

List box is refreshing all the time when we open subfrom(frmSub) individually.
As it individual form we don't have any issue.

Issue:
We have draged frmSub into main form and tried to open the form there it was
asking Country,Product_Name, Emp_Name as parameters while opening main form.

Please share your thoughts and ideas in resolving the above said issue which
will be appreciated.

Regards
~Vins
 
A

Armen Stein

We have draged frmSub into main form and tried to open the form there it was
asking Country,Product_Name, Emp_Name as parameters while opening main form.

It would be a lot easier to refer to the fields on your subform with a
Me reference, like (untested aircode):

Where (Nz([Country]," ") Like """ & Nz(Me.Country) & "*","*") & """

Note that you have to drop out of your literal string to concatenate
anything that's evaluated in the form code, like Me.

Armen Stein
Microsoft Access MVP
www.JStreetTech.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top