getting desperate! option group and multiple whereconditions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Boy am I stuck, and I fear I'm mission something obvious. Can someone please
help??

I have a form with 3 *required* parameters on it:
** an option box, optCoInd: user must check either Company or Industry
** a combo box, cboAttribute: user must select from several drop down
Attributes
** a combo boc, cboYearsonFile: user must select from several drop down Years

Once completed, the user of naturally presses a Go command button. I'm
unable to get the VB syntax correct for the event procudure associated with
this button due to the multiple whereconditions.

Additionally, regarding the option box selection: the Company and Industry
data (consisting of years and attributes) come from separate tables -
tblCompanies and tblIndustries - I'm unclear how to structure the underlying
query for this output, given that the query's base data needs to "toggle"
between tblCompanies and tblIndustries. Can anyone offer some help ???

Very very much appreciated. . .

Marika :)
 
The option box is going to return a numeric value, dependent on what value
you gave the two options. Will that numeric value correspond to what you're
actually trying to look up, or do you need to translate the numbers to
something useful to you?

Now, you talking about being "unable to get the VB syntax correct for the
event procedure". What is it you're trying to do? I'll assume it's use the
values selected as a WHERE clause for opening another form. If not, post
back:

DoCmd.OpenForm FormName:="MyForm", _
WhereCondition = "CoInd = " & Me.optCoInd & _
" And Attribute = " & Me.cboAttribute & _
" AND YearsOnFile = " & Me.cboYearsOnFile

This assumes that the bound value in both cboAttribute and cboYearsOnFile is
numeric. If, say, cboAttribute is returning a string, you'd use

" And Attribute = '" & Me.cboAttribute & "'" & _

or

" And Attribute = " & Chr(34) & Me.cboAttribute & Chr(34) & _

I'm not quite sure what your second question is about. Are you saying that
you need to change the record source of the two combo boxes depending on
which option was selected in optCoInd? In the AfterUpdate event for
optCoInd, put logic that sets the RecordSource property for the combo boxes
dependent on which option was selected.
 

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

Back
Top