Combobox filter default value before form open

S

Stalin

I have a combobox [me.cmbx_example] who's recordsource is a valid sql
statement which returns a list of usernames on form open.

I have an additional field [me.curr_user] that holds the current
network user name on form open.

I would like to filter the default value to the username that matchs
[me.curr_user].

something like "if me.cmbx.example.defaultvalue =
me.curr_user ....where me.cmbx.example.itemvalue = me.curr_user...."

would I need to loop through the combo values to do this or is there a
filter property I'm not seeing?

Any suggestions are appreciated.
 
M

Marshall Barton

Stalin said:
I have a combobox [me.cmbx_example] who's recordsource is a valid sql
statement which returns a list of usernames on form open.

I have an additional field [me.curr_user] that holds the current
network user name on form open.

I would like to filter the default value to the username that matchs
[me.curr_user].

something like "if me.cmbx.example.defaultvalue =
me.curr_user ....where me.cmbx.example.itemvalue = me.curr_user...."

would I need to loop through the combo values to do this or is there a
filter property I'm not seeing?


You can select a row in a combo box by setting its Value.
If the value is not in the list, the ListIndex property will
be -1 and if it is in the list, ListIndex will have the
matching row's rownumber.
 
S

Stalin

Stalin said:
I have a combobox [me.cmbx_example] who's recordsource is a valid sql
statement which returns a list of usernames on form open.
I have an additional field [me.curr_user] that holds the current
network user name on form open.
I would like to filter the default value to the username that matchs
[me.curr_user].
something like "if me.cmbx.example.defaultvalue =
me.curr_user ....where me.cmbx.example.itemvalue = me.curr_user...."
would I need to loop through the combo values to do this or is there a
filter property I'm not seeing?

You can select a row in a combo box by setting its Value.
If the value is not in the list, the ListIndex property will
be -1 and if it is in the list, ListIndex will have the
matching row's rownumber.

Perfect,

Thanks
Stalin
 

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