Re: Converting Numerical Value to Lookup value
From: SteveS (sanfu_at_techie.com)
Date: 03/07/05
- Next message: JohnFol: "Re: saving data fields from a word 2002 to excel 2002"
- Previous message: aj20: "list view"
- In reply to: Dan: "Converting Numerical Value to Lookup value"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 07 Mar 2005 00:15:52 -0900
I'm not really sure what you are trying to do but maybe I can get you
started.
Comments inline....
Dan wrote:
> I am using an expression in Forms to take several fields of data and convert
> them to a block of text.
>
> For one of the fields set-up as a combo box, it is based on a Lookup of a
> separate table to text in a specified field. The table of data that is
> looked up has 3 fields/columns: Index [numeric, 1-12], Eng [Month of the
> year in English], Fr [Month of the year in French].
>
You have a combo box (I'll call it cboMonth) with the row source set to
a query or SQL statement that looks something like this:
"Select Index, Eng, Fr From tblEng_Fr_Month Order by Index"
The bound column should be 1 and the column count should be 3.
> When I concatenate the fields into the expression, the field for looking up
> the month (named [FMonth] or [EMonth]) displays as the numeric value of the
> lookup table, not the corresponding French or English value as it does in
> the rest of the form. Rendering this value through a simple statement of
> [FMonth] is sufficient. Deriving the value of does not require use of ! and
> . operators to specifically call on the data from elsewhere in the form.
>
Are FMonth and EMonth unbound text boxes on the form that you want to
display the French/English names of the months when a month is selected
from the combo box?
> I've posted this problem on a couple of other forums and received a reply to
> make the following statement:
> MyCombo.Column(1)
>
This syntax is how you reference columns other that the bound column of
a COMBO BOX or LIST BOX. It doesn't apply to text boxes.
"MyCombo" is an example of a combo box name. You need to substitute the
name of your combo box.
> Given this, I have adapted it to [fmonth].column(2) to display the French
> month, for instance (note table structure in second paragraph above).
> However, upon entering this in Expression Builder, the system corrects the
> syntax to [fmonth].[column](2) which results in #Error when displayed.
>
See previous paragraph.
If you want the unbound text box FMonth to display the French name of
the month when a month is selected using the combo box, you would set
the control source of FMonth to = ComboBoxName.Column(2). (Remember,
combo boxes are zero based - the first column is column 0)
If the combo box is named "cboMonth", then the control source for FMonth
would be: =cboMonth.Column(2)
EMonth would be: =cboMonth.Column(1)
> What is the syntax required in expression builder to have a lookup table
> display information from a specified column when the field already
> displaying the information renders a PI of the numeric value from column 0?
>
>
As an example, If the control sources were:
EMonth control source: =cboMonth.Column(1)
FMonth control source: =cboMonth.Column(2)
,in the after update event of the combo box, you could use a message box
to display the translated month name using the unbound text boxes:
Msgbox "Month " & Me.cboMonth & " in English is " & EMonth & " and in
French is " & FMonth & ". "
You don't even need to use the unbound text boxes unless you want to
display the month names! You can just use the combo box:
Msgbox "Month " & Me.cboMonth & " in English is " &
Me.cboMonth.Column(1) & " and in French is " & Me.cboMonth.Column(2) & "."
(The above should be on one line)
***NOTE: change "cboMonth" to the name of your combo box.
HTH
-- Steve -------------------------------- "Veni, Vidi, Velcro" (I came, I saw, I stuck around.)
- Next message: JohnFol: "Re: saving data fields from a word 2002 to excel 2002"
- Previous message: aj20: "list view"
- In reply to: Dan: "Converting Numerical Value to Lookup value"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|