Access\Visual Basic help

  • Thread starter jjsaw5 via AccessMonster.com
  • Start date
J

jjsaw5 via AccessMonster.com

Hello,

Can someone help me generate some VB code to do the following...

I have a text box that displays a projects status, but the status is
displayed as a number and the number means something like " Completed" or "In
Development".

Is there a way that i can have some VB code look and see that if there is an
8, then display "Completed" or if there is a 10 it displacy "In development"?
 
F

fredg

Use an unbound text control.

Are those the ONLY choices?
If so....
=IIf([FieldName]=8,"Completed","In Developement")

If there are more choices, then something like this:
=IIf([FieldName] = 8,"Completed",IIf([FieldName]= 10,"In Developement","Some
other value here"))

Fred
 
S

Steve

You don't need VB code for this. Base your form or report on a query that
includes your project table nd your status table. The query needs the
fields:
ProjectName from the project table
Status from the status table.

Bind your textbox to the status field.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
[email protected]
 
J

jahoobob via AccessMonster.com

Place this in the recordsource of said textbox:
=IIf(yourfield=1,"Completed","In development")
Better still, if the source is a query make a new field in the query:
NewField:IIf(yourfield=1,"Completed","In development")
 
J

jjsaw5 via AccessMonster.com

i can't find a recordsource only a control source for the text box...and when
i put it in there i get #NAME?
Place this in the recordsource of said textbox:
=IIf(yourfield=1,"Completed","In development")
Better still, if the source is a query make a new field in the query:
NewField:IIf(yourfield=1,"Completed","In development")
[quoted text clipped - 6 lines]
Is there a way that i can have some VB code look and see that if there is an
8, then display "Completed" or if there is a 10 it displacy "In development"?
 
K

Klatuu

This being a bound control will make it impossible to translate the code to a
description.
My suggestion would be to replace the existing text box with a combo box.
The combo box should still be bound to the code field, but the row source of
the combo should be a query based on the status code table. You will need
two columns, the code and the description.
The first column should be the code and the second the description. Now,
set these properties of the combo:
Column Count 2
Bound Column 1
Column Widths 0";1.5"

Now, the user will only see the description, but the code will be saved in
the record.
Additionally, I would set the Limit To List property to Yes. Whether you
want to allow the user to actually add new status codes is your decision. If
you want to allow it and are uncertain of the technique, I will be happy to
assist with that as well.
--
Dave Hargis, Microsoft Access MVP


jjsaw5 via AccessMonster.com said:
i can't find a recordsource only a control source for the text box...and when
i put it in there i get #NAME?
Place this in the recordsource of said textbox:
=IIf(yourfield=1,"Completed","In development")
Better still, if the source is a query make a new field in the query:
NewField:IIf(yourfield=1,"Completed","In development")
[quoted text clipped - 6 lines]
Is there a way that i can have some VB code look and see that if there is an
8, then display "Completed" or if there is a 10 it displacy "In development"?
 
Top