Access 2000 / AfterUpdate control not working for combo box

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

cj_borntorun

Thread Starter
Joined
Jan 3, 2004
Messages
30
Here's are the facts regarding my Access form:


- Combo Box "Segment" allows user to make a selection
- Combo Box "Fgroup" limits the user choices to only those applicable to the Segment they selected.
- I would like to display (for the user) a 2-column combo box with "Fgroup_ID" in column 1 and "Fgroup" in column 2. Only the "Fgroup" needs to be bound and stored in my underlying table. The "Fgroup_ID" is strictly there for informational purposes to assist the user in making their selection.

PROBLEM: I think the AfterUpdate on the Segment combo box is not recognizing both the Fgroup and Fgroup_ID columns. Can someone review this code and tell me what and where to insert the "Fgroup_ID" column information? I'm a rookie at writing code and appreciate any help I can get. I'm going to (try) to attach 2 printscreens of what the drop down list provides now, and what I would like it to


'After the user selects a Segment, it limits the list of Fgroups to only those applicable
'to the selected Segment.


Private Sub cboSEGMENT_AfterUpdate()
On Error Resume Next
cboFGROUP.RowSource = "Select tPRODUCT_FGROUP.FGROUP " & _
"FROM tPRODUCT_FGROUP " & _
"WHERE tPRODUCT_FGROUP.SEGMENT = '" & cboSEGMENT.Value & "' " & _
"ORDER BY tPRODUCT_FGROUP.FGROUP_ID;"

End Sub

'Allows the user to requery the list of Fgroup names as a new Segment is selected.

Private Sub FGROUP_AfterUpdate()
FGROUP.Requery
End Sub

Private Sub SEGMENT_AfterUpdate()
FGROUP.Requery
End Sub
 

Attachments

OBP

Joined
Mar 8, 2005
Messages
19,895
Have you set the Combo box's column count to 2?
Have you set the Column widths wide enough to display the data?
 

cj_borntorun

Thread Starter
Joined
Jan 3, 2004
Messages
30
I just looked to double-check both of those and yes:

Column Count= 2
Column Widths = 1";3.5"
 

cj_borntorun

Thread Starter
Joined
Jan 3, 2004
Messages
30
I changed my code as follows and now its working:

Private Sub cboSEGMENT_AfterUpdate()
On Error Resume Next
cboFGROUP.RowSource = "Select tPRODUCT_FGROUP.FGROUP_ID,FGROUP " & _
"FROM tPRODUCT_FGROUP " & _
"WHERE tPRODUCT_FGROUP.SEGMENT = '" & cboSEGMENT.Value & "' " & _
"ORDER BY tPRODUCT_FGROUP.FGROUP_ID;"

End Sub


Thanks,
;)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top