Combo Box Default (1 Viewer)

Damo G

New member
Local time
Today, 10:53
Joined
Jan 6, 2020
Messages
4
Hi All,

I have two tables, [Users] with a PK of [User ID] and [Locations] with a PK of [Location ID]. The [Users] table has a FK of [Default Location ID].

I have a form with two combo boxes [cboUser] and [cboLocation] whose row sources are the two tables. When I select a User in [cboUser], I want the Default Value in [cboLocation] to update to the [Default Location ID] for the selected user.

Any ideas?

Damo G
 

bob fitz

AWF VIP
Local time
Today, 17:53
Joined
May 23, 2011
Messages
4,717
Hi All,

I have two tables, [Users] with a PK of [User ID] and [Locations] with a PK of [Location ID]. The [Users] table has a FK of [Default Location ID].

I have a form with two combo boxes [cboUser] and [cboLocation] whose row sources are the two tables. When I select a User in [cboUser], I want the Default Value in [cboLocation] to update to the [Default Location ID] for the selected user.

Any ideas?

Damo G
Use one combo box to select the user and populate a textbox with the location using a hidden column in the combo box.
See db attached for example:
 

Attachments

  • Test.mdb
    300 KB · Views: 63

Damo G

New member
Local time
Today, 10:53
Joined
Jan 6, 2020
Messages
4
Thanks Bob,

I wast just fiddling around with it and I came to a very similar conclusion. I used a Macro in the OnUpdate event for cboUsers to set the value property of cboLocation to '=[cboCurrentUser].[Column](3)'.

Great to get such a quick and useful response!:)
 

bob fitz

AWF VIP
Local time
Today, 17:53
Joined
May 23, 2011
Messages
4,717
Thanks Bob,

I wast just fiddling around with it and I came to a very similar conclusion. I used a Macro in the OnUpdate event for cboUsers to set the value property of cboLocation to '=[cboCurrentUser].[Column](3)'.

Great to get such a quick and useful response!:)
If you set the ControlSource Property of cboLocation to =[cboCurrentUser].[Column](3) you don't even need to use a macro.

Good luck with your project
 

Damo G

New member
Local time
Today, 10:53
Joined
Jan 6, 2020
Messages
4
Small issue...

Problem with setting the ControlSource Property is that if you want to change from the default location, you can't select an alternative from the combo list. However, if you set the Default Value property of cboLocation to '=[cboCurrentUser].[Column](3)' it now works.

Thx
 

Users who are viewing this thread

Top Bottom