Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem 1; Cascading Combo box

Status
Not open for further replies.

antihippy

Technical User
Aug 29, 2003
47
0
0
GB
Hi There,

I've got a problem with cascading combo boxes. First some background:

I am using Access 2003 to write a little helpdesk app.

I have a Table and form (tbl and frm Helpdesklog) which lists the bulk of the users details plus descriptions of the various requests. I have a second table (tblAssets) that contains asset information. And a third table called tblUsers which I am using to link the two.

Here's the problem:

cboUser looks up an ID and username.

Code:
tblUsers
--------
UserID  User
1   user1
2   user2

Sql for combo box:

SELECT tblUsers.UserID, tblUsers.User
FROM tblUsers
ORDER BY tblUsers.User;

In cboUser 1 I have placed the code

Code:
me.cboUSer.ReQuery

In the AfterUpdate property - yet the query doesn't appear to be requerying. Can someone point out where I am going wrong?

My second combo box (cboTag) matches the User field with the entry for Primary User in tblAssets and displays the value of Tag (it's the number assigned to the equipemt).

Here's the SQL for cboTag:

Code:
SELECT DISTINCT tblAssets.Tag, tblAssets.Type FROM tblAssets INNER JOIN (tblHelpDeskLog INNER JOIN tblUsers ON tblHelpDeskLog.User = tblUsers.UserID) ON tblAssets.[Primary User] = tblUsers.User WHERE (((tblHelpDeskLog.User)=[Forms]![frmHelpDeskLog]![cboUser]));


The problem I have is that no matter what I do, the values in cboTag only change once per loaded form. In order to get them to change I have to close and reopen the form.

By the way I didn't name the tables and I fid the naming convention confusing (they are frequently named after the form controls) - I've attempted to tidy this up for you.
 
How are ya antihippy . . . . .

For [blue]cboUser[/blue], move the requery to the [blue]AfterUpdate[/blue] event of the form.

For [blue]cboTag[/blue] requery the combobox in the [blue]Current[/blue] event of the form.

Calvin.gif
See Ya! . . . . . .
 
Hey AceMan1

I'm fine. It's Monday and I have the same headache. The damn cbo will not requery. I made your suggested alteration.

Any other thoughts?
 
In the AfterUpdate Event of the "cboUser" you need the "cboTags" to requery.
Code:
Me.cboTags.Requery

________________________________________________________
Zameer Abdulla
Help to find Missing people
You may be the boss' pet; but you are still an animal
 
Actually I fixed it. I entered me.cbotag.requery in the AfterUpdate property in cboUser. I think I was confusing myself about which objects I wanted to requesry. Seems to work now and it updates dynamically (which is what I wanted). Thanks AceMan you put me on the right track.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top