using selection in combo box to filter another combo box display

G

Guest

I have a subform with two combo boxes and I want the data displayed in the second box to be based on the selection from the first combo box. I am using a SQL statement in the record source with a WHERE statement to equate the two selections. This works fine when i open the subform on its own but when I open the main form where the subform is on a Tab control Page it no longer works. The subform is linked to the main form on an unique ID number. When I open the main form, I get a msg box asking me to enter a parameter value for the criteria statement. Any ideas?
 
P

prabha

Hi,

In your SQL statement you most likely have something like:

Select * From TableX Where [field1] = Forms![Name of
Form]![Control on Form]

it works when the Form is opened by itself. It fails when the Form is
opened as a subForm because the Form [Name of Form] is not in the Forms
collection. So what you need to do is modify your SQL statement to
something like:

Select * From TableX Where [field1] =
Forms![Name of main Form]![subForm control].Form![name of
control on subForm]

See: ACC2000: How to Refer to a Control on a Subform or Subreport
http://support.microsoft.com/default.aspx?scid=kb;en-us;209099

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."


--------------------
| Thread-Topic: using selection in combo box to filter another combo box
display
| thread-index: AcPs5PwXXXn2g+M5RD2fUpjv3hd2ZQ==
| X-Tomcat-NG: microsoft.public.access.formscoding
| From: =?Utf-8?B?TVJS?= <[email protected]>
| Subject: using selection in combo box to filter another combo box display
| Date: Fri, 6 Feb 2004 11:11:12 -0800
| Lines: 2
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.access.formscoding
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.formscoding:219523
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.access.formscoding
|
| I have a subform with two combo boxes and I want the data displayed in
the second box to be based on the selection from the first combo box. I am
using a SQL statement in the record source with a WHERE statement to equate
the two selections. This works fine when i open the subform on its own but
when I open the main form where the subform is on a Tab control Page it no
longer works. The subform is linked to the main form on an unique ID
number. When I open the main form, I get a msg box asking me to enter a
parameter value for the criteria statement. Any ideas?

|
 

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