By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,500 Members | 830 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,500 IT Pros & Developers. It's quick & easy.

Find info based on an item selected in a cboBox

P: n/a
I have a dropbox (cboReasons) in a form, when the user selects a
reason from the
dropbox the form needs to look in another table (lvsn_DefaultSettings)
and see if there is a entry for that reason DLookup("[DefaultItem]",
"lvsn_DefaultValues", Me.cboReasons). If it
finds one it needs to update some check boxes on the form.
for expample

User selects Reason = "Sales"
found record in lvsn_DefaultValues for "Sales"
Set chkFees=-1
Set chkPaid=0

Reason = "SalesPerson"
No Record Found = doNothing

I am not sure how to get the DB to find the record then move the data
over to the form. I can do it with the dlookup but only for this
first record. None of the others. Thanks
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
create a query that links the two tables and display 3 columns
reasonId, reason, defaultItem

and in your combo box, show 3 columns with a width of 0;2";0 (which
will show the reason that you see now)

use cboReasons.column(2) to access the value of defaultItem (reasonId
is column 0)

jo***********@socal.rr.com (Josh Armstrong) wrote in message news:<b6**************************@posting.google. com>...
I have a dropbox (cboReasons) in a form, when the user selects a
reason from the
dropbox the form needs to look in another table (lvsn_DefaultSettings)
and see if there is a entry for that reason DLookup("[DefaultItem]",
"lvsn_DefaultValues", Me.cboReasons). If it
finds one it needs to update some check boxes on the form.
for expample

User selects Reason = "Sales"
found record in lvsn_DefaultValues for "Sales"
Set chkFees=-1
Set chkPaid=0

Reason = "SalesPerson"
No Record Found = doNothing

I am not sure how to get the DB to find the record then move the data
over to the form. I can do it with the dlookup but only for this
first record. None of the others. Thanks

Nov 12 '05 #2

P: n/a
I thought about that but I have to many fields that need to be filled
out, I only used a few for the example. The combo box lists about 150
reasons, only about 30 have static info behind them.

le*********@natpro.com (Roger) wrote in message news:<8c**************************@posting.google. com>...
create a query that links the two tables and display 3 columns
reasonId, reason, defaultItem

and in your combo box, show 3 columns with a width of 0;2";0 (which
will show the reason that you see now)

use cboReasons.column(2) to access the value of defaultItem (reasonId
is column 0)

jo***********@socal.rr.com (Josh Armstrong) wrote in message news:<b6**************************@posting.google. com>...
I have a dropbox (cboReasons) in a form, when the user selects a
reason from the
dropbox the form needs to look in another table (lvsn_DefaultSettings)
and see if there is a entry for that reason DLookup("[DefaultItem]",
"lvsn_DefaultValues", Me.cboReasons). If it
finds one it needs to update some check boxes on the form.
for expample

User selects Reason = "Sales"
found record in lvsn_DefaultValues for "Sales"
Set chkFees=-1
Set chkPaid=0

Reason = "SalesPerson"
No Record Found = doNothing

I am not sure how to get the DB to find the record then move the data
over to the form. I can do it with the dlookup but only for this
first record. None of the others. Thanks

Nov 12 '05 #3

P: n/a
do you mean that one combobox selection causes many fields on your
form to be updated ? how many fields ?

you could put code in the cboReasons 'change' event that
strSql = "SELECT * FROM lvsn_defaultvalues WHERE defaultItem = " &
cboReasons
set rs = currentdb.openRecordset(strsql)
if not(rs.eof) then
chkFees=-1
chkPaid=0
...
endif

rs.close
set rs = nothing
are chkFees and chkPaid bound controls ? or they locked or can I click
on them
to change their value ?

if these fields are locked and are for information only... what about
creating a query that selects all these fields, creating a sub form
based on the query and displaying all these fields in the subform...
where the link is 'reasons'

jo***********@socal.rr.com (Josh Armstrong) wrote in message news:<b6*************************@posting.google.c om>...
I thought about that but I have to many fields that need to be filled
out, I only used a few for the example. The combo box lists about 150
reasons, only about 30 have static info behind them.

le*********@natpro.com (Roger) wrote in message news:<8c**************************@posting.google. com>...
create a query that links the two tables and display 3 columns
reasonId, reason, defaultItem

and in your combo box, show 3 columns with a width of 0;2";0 (which
will show the reason that you see now)

use cboReasons.column(2) to access the value of defaultItem (reasonId
is column 0)

jo***********@socal.rr.com (Josh Armstrong) wrote in message news:<b6**************************@posting.google. com>...
I have a dropbox (cboReasons) in a form, when the user selects a
reason from the
dropbox the form needs to look in another table (lvsn_DefaultSettings)
and see if there is a entry for that reason DLookup("[DefaultItem]",
"lvsn_DefaultValues", Me.cboReasons). If it
finds one it needs to update some check boxes on the form.
for expample

User selects Reason = "Sales"
found record in lvsn_DefaultValues for "Sales"
Set chkFees=-1
Set chkPaid=0

Reason = "SalesPerson"
No Record Found = doNothing

I am not sure how to get the DB to find the record then move the data
over to the form. I can do it with the dlookup but only for this
first record. None of the others. Thanks

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.