PC Review


Reply
Thread Tools Rate Thread

Continuous Forms - Combo box.RowSource

 
 
Stapes
Guest
Posts: n/a
 
      23rd May 2007
Hi
I have a subform with the records displayed in the Continuous Forms
view. On each line, I have a group & a subgroup. Both fields are Combo
boxes. What I am trying to do is limit the choice of subgroups to
those pertaining to the group shown.
I have tried putting code in the On Current event in the form to allow
only the correct subgroups in the Combo box, but it seems to take the
criteria for the top record & apply it to all the others.

This is the code:-

Dim strSQL As String
strSQL = "SELECT TLK_SubGroups.PK_SubGroup,
TLK_SubGroups.TXT_SubAbriv, TLK_SubGroups.TXT_SubDet,
TLK_SubGroups.FK_MainGroup " & _
"FROM TLK_SubGroups " & _
"WHERE (((TLK_SubGroups.FK_MainGroup)=" & PK_Group & "));"

PK_SubGroup.RowSource = strSQL
PK_SubGroup.Requery

Any ideas how I can make it work?

Stapes

 
Reply With Quote
 
 
 
 
=?Utf-8?B?cmljbw==?=
Guest
Posts: n/a
 
      23rd May 2007
Stapes,

You could try putting that code in the OnEnter event of the combo box, so it
would should run it before the list drops down.
(have not tested).

HTH

Rico

"Stapes" wrote:

> Hi
> I have a subform with the records displayed in the Continuous Forms
> view. On each line, I have a group & a subgroup. Both fields are Combo
> boxes. What I am trying to do is limit the choice of subgroups to
> those pertaining to the group shown.
> I have tried putting code in the On Current event in the form to allow
> only the correct subgroups in the Combo box, but it seems to take the
> criteria for the top record & apply it to all the others.
>
> This is the code:-
>
> Dim strSQL As String
> strSQL = "SELECT TLK_SubGroups.PK_SubGroup,
> TLK_SubGroups.TXT_SubAbriv, TLK_SubGroups.TXT_SubDet,
> TLK_SubGroups.FK_MainGroup " & _
> "FROM TLK_SubGroups " & _
> "WHERE (((TLK_SubGroups.FK_MainGroup)=" & PK_Group & "));"
>
> PK_SubGroup.RowSource = strSQL
> PK_SubGroup.Requery
>
> Any ideas how I can make it work?
>
> Stapes
>
>

 
Reply With Quote
 
Roger Carlson
Guest
Posts: n/a
 
      23rd May 2007
On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "CascadingComboInSubform.mdb" which illustrates how to do
this.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L


"Stapes" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
> I have a subform with the records displayed in the Continuous Forms
> view. On each line, I have a group & a subgroup. Both fields are Combo
> boxes. What I am trying to do is limit the choice of subgroups to
> those pertaining to the group shown.
> I have tried putting code in the On Current event in the form to allow
> only the correct subgroups in the Combo box, but it seems to take the
> criteria for the top record & apply it to all the others.
>
> This is the code:-
>
> Dim strSQL As String
> strSQL = "SELECT TLK_SubGroups.PK_SubGroup,
> TLK_SubGroups.TXT_SubAbriv, TLK_SubGroups.TXT_SubDet,
> TLK_SubGroups.FK_MainGroup " & _
> "FROM TLK_SubGroups " & _
> "WHERE (((TLK_SubGroups.FK_MainGroup)=" & PK_Group & "));"
>
> PK_SubGroup.RowSource = strSQL
> PK_SubGroup.Requery
>
> Any ideas how I can make it work?
>
> Stapes
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box values and continuous forms SidVicious General Software 1 21st Jul 2011 05:11 PM
Continuous Form Combo Box with rowsource based on hidden field. =?Utf-8?B?Umlja2V0eTEwNw==?= Microsoft Access Form Coding 0 6th Nov 2007 06:46 PM
Cascading combo on continuous forms =?Utf-8?B?V2F5bmUtSS1N?= Microsoft Access 5 16th May 2007 02:57 PM
Combo boxes on continuous sub-forms, with different value lists David Walker Microsoft Access 4 27th Jul 2004 07:13 PM
Combo boxes on continuous forms Joan Edington Microsoft Access Forms 2 27th Aug 2003 01:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:22 AM.