Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / August 2007

Tip: Looking for answers? Try searching our database.

switch function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gina - 03 Aug 2007 16:24 GMT
I have a form retrieving data from db2, and I want to convert code values to
description. I tried to use Control Source and

switch([CHN_CD]="01", "FLS", [CHN_CD]="02", "ONL")

[CHN_CD] is from data field... I tried different combinations of this
statement... never made it work... I am wondering whether it should be done
somewhere other than control source, or the reference to the field is
incorrect... please help.
BruceM - 03 Aug 2007 17:42 GMT
As the Control Source for a text box you would need an = sign in front of
the expression.  However, maybe there is a problem elsewhere.  What do you
mean when you say that [CHN_CD] is a data field?  The data type is defined
in table design view.  Is it text, number, or what exactly?

>I have a form retrieving data from db2, and I want to convert code values
>to
[quoted text clipped - 7 lines]
> somewhere other than control source, or the reference to the field is
> incorrect... please help.
gina - 03 Aug 2007 18:14 GMT
= sign is automatically put ... so that was not the issue.
i.e.
=switch([CHN_CD]="01", "FLS", [CHN_CD]="02", "ONL")

[CHN_CD] is the field name in the db2 table which form is reading from...

> As the Control Source for a text box you would need an = sign in front of
> the expression.  However, maybe there is a problem elsewhere.  What do you
[quoted text clipped - 12 lines]
> > somewhere other than control source, or the reference to the field is
> > incorrect... please help.
fredg - 03 Aug 2007 18:47 GMT
> = sign is automatically put ... so that was not the issue.
> i.e.
[quoted text clipped - 18 lines]
>>> somewhere other than control source, or the reference to the field is
>>> incorrect... please help.

You still haven't answered the question as to what the [CHN_CD]
datatype is.
Is it a Number datatype or Text?
Is it included in the recordsource of the form?
What does "Never made it work" mean?
Do you get an incorrect value?
An #Error is displayed in the box?
No value?
What?

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

gina - 03 Aug 2007 19:12 GMT
data type is char(2)
I get #Error
Never made it work => I tried IIf statement, etc. and didn't work either.

I created the form using form wizard, and selected this field from the table
to be on the form.
Hope this helps you to answer my question. thanks!

> > = sign is automatically put ... so that was not the issue.
> > i.e.
[quoted text clipped - 28 lines]
> No value?
> What?
BruceM - 03 Aug 2007 19:35 GMT
Open the table in design view.  Next to the Field Name column is a Data Type
column.  What is the data type for the field CHN_CD?

> data type is char(2)
> I get #Error
[quoted text clipped - 43 lines]
>> No value?
>> What?
gina - 03 Aug 2007 19:56 GMT
I don't see anything that looks like a data type in the design view.
the form design looks like
form header
Detail
greyed box with column_name and white box with column_name
form footer

how can I see data types?

> Open the table in design view.  Next to the Field Name column is a Data Type
> column.  What is the data type for the field CHN_CD?
[quoted text clipped - 46 lines]
> >> No value?
> >> What?
BruceM - 03 Aug 2007 20:44 GMT
Open the *table* in design view.  Not the form, but the table that contains
the field CHN_CD.

>I don't see anything that looks like a data type in the design view.
> the form design looks like
[quoted text clipped - 62 lines]
>> >> No value?
>> >> What?
gina - 07 Aug 2007 13:30 GMT
Data Type is "Text" with Field Size 2

> Open the *table* in design view.  Not the form, but the table that contains
> the field CHN_CD.
[quoted text clipped - 65 lines]
> >> >> No value?
> >> >> What?
BruceM - 07 Aug 2007 17:46 GMT
Is it "01", "02", etc. or is it "1", "2".  The reason I ask is that I can't
see a reason why Switch won't work.  If you set the text box control source
to =[CHN_CD] to you see the correct value?

> Data Type is "Text" with Field Size 2
>
[quoted text clipped - 75 lines]
>> >> >> No value?
>> >> >> What?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.