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 display "In development"?
Visual Basic is going to be the end of me lol
17 1627
I have a text box ... 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 display "In development"?
Substituting a string for a number is in itself quite simple, of course. But can you give us a bit more detail? For instance, what version of VB are you using? Is the textbox bound to anything? Is the value of the textbox of any significance to the program, or just a display for the user? Is it modifiable by the user, or locked?
Substituting a string for a number is in itself quite simple, of course. But can you give us a bit more detail? For instance, what version of VB are you using? Is the textbox bound to anything? Is the value of the textbox of any significance to the program, or just a display for the user? Is it modifiable by the user, or locked?
Yes not a problem at all
I am running VB 6.3.
The text box is bound to an ID field in a table( which is made by a make table query that pulls all information from a linked DB). The data in the table is either one of two statuses, Ready For Development or In Development. But my problem is that these statuses are identified by a number.
8= Ready for Dev
10= In dev
On my form i have a status box and it is only showing a number id like it to show Ready for Dev. if there is an 8 in the box and In Dev if there is a 10 in the box.
Yes not a problem at all
I am running VB 6.3.
The text box is bound to an ID field in a table( which is made by a make table query that pulls all information from a linked DB). The data in the table is either one of two statuses, Ready For Development or In Development. But my problem is that these statuses are identified by a number.
8= Ready for Dev
10= In dev
On my form i have a status box and it is only showing a number id like it to show Ready for Dev. if there is an 8 in the box and In Dev if there is a 10 in the box.
in your query add a case statement, this will work in sql server as SQL so i think it should work for access if you add it in the sql query.
wher eyou have stated the selecting the Id in the query swap it with the following
"Select Case When Id = 8 Then 'Ready for Dev' When id = 10 Then 'In Dev' End"
then add the rest or ur select statement
in your query add a case statement, this will work in sql server as SQL so i think it should work for access if you add it in the sql query.
wher eyou have stated the selecting the Id in the query swap it with the following
"Select Case When Id = 8 Then 'Ready for Dev' When id = 10 Then 'In Dev' End"
then add the rest or ur select statement
Or ultimatly
just case your result.
Select Case (yourResult: should be a number in your case)
Case is 10
textbox.text1.text = 'In Dev'
Case is 8
textbox.text = 'Ready for Dev'
End select
in this case you do not want to assign the textbox to anything
have a think about what you are trying to do if you still can't solve it,
because there are many way such making the current textbox.visable = false and use this value in a case statement and populate a textbox that is visable
in your query add a case statement, this will work in sql server as SQL so i think it should work for access if you add it in the sql query.
wher eyou have stated the selecting the Id in the query swap it with the following
"Select Case When Id = 8 Then 'Ready for Dev' When id = 10 Then 'In Dev' End"
then add the rest or ur select statement
Unfortunately this form is running off of a table not a query.
I created a query using Design view and then switched over to the SQL view, here is the code it gives me.... - SELECT TRKALLIMSPROJECTS_TRKSCRSL.X5, TRKALLIMSPROJECTS_TRKSCRSL.X14, TRKALLIMSPROJECTS_TRKSCRST.Z1, TRKALLIMSPROJECTS_TRKSCRST.Z2, TRKALLIMSPROJECTS_TRKSCRST.Z3, TRKALLIMSPROJECTS_TRKSCRST.Z6
-
FROM TRKALLIMSPROJECTS_TRKSCRSL INNER JOIN TRKALLIMSPROJECTS_TRKSCRST ON TRKALLIMSPROJECTS_TRKSCRSL.ID = TRKALLIMSPROJECTS_TRKSCRST.ID;
-
X14 is the field with the status ID, where should i place your code?
I tried it on my own but couldn't get it to work
I've just used the query builder in Access to put together simple examples of using the IIF() and Choose() functions to decode a field. I just created a simple table with three fields called a (Text), b (Text) and c (Number). Here's the sample query... - SELECT Table1.a, Table1.b,
-
IIf([c]=8,"Ready for Dev","In Development") AS Converted,
-
Choose([c],"","","","","","","","Ready for Dev","","In Development") AS Status
-
FROM Table1;
Here are the restults when I fed in some numbers... - c Converted Status
-
1 In Development
-
4 In Development
-
8 Ready for Dev Ready for Dev
-
5 In Development
-
9 In Development
-
10 In Development In Development
-
4 In Development
-
8 Ready for Dev Ready for Dev
-
2 In Development
I'm sorry guys but i can't get any of these to work....what about using the expression builder on the text box?
I'm sorry guys but i can't get any of these to work....what about using the expression builder on the text box?
I still think the Choose() function should do the trick.
I still think the Choose() function should do the trick.
Ok where im having trouble is incorporating that into my statement in post #6
I'm still at a stand still on this....i walked away form the whole project this weekend just to clear my head and get away from it lol....
I'm still at a stand still on this....i walked away form the whole project this weekend just to clear my head and get away from it lol....
Sorry, I'll have to get back to this thread at lunch time (a few hours from now).
Ok, for starters I have to say, I'm not too impressed with your field names. :( (The table names a far too similar, as well - very difficult to work with, in my opinion.)
I've chopped up the SQL a bit so I could follow it, but here's what I've come up with... - SELECT TRKALLIMSPROJECTS_TRKSCRSL.X5,
-
TRKALLIMSPROJECTS_TRKSCRSL.X14,
-
TRKALLIMSPROJECTS_TRKSCRST.Z1,
-
TRKALLIMSPROJECTS_TRKSCRST.Z2,
-
TRKALLIMSPROJECTS_TRKSCRST.Z3,
-
TRKALLIMSPROJECTS_TRKSCRST.Z6,
-
Choose([TRKALLIMSPROJECTS_TRKSCRSL.X14], "", "", "", "", "", "", "", "Ready for Dev", "", "In Development") As Status
-
-
FROM
-
-
TRKALLIMSPROJECTS_TRKSCRSL
-
INNER JOIN
-
TRKALLIMSPROJECTS_TRKSCRST
-
-
ON
-
-
TRKALLIMSPROJECTS_TRKSCRSL.ID = TRKALLIMSPROJECTS_TRKSCRST.ID;
I don't know whether this will work or not - I've just tried to incorporate the Choose() function into your SQL. I'd recommend that for further help along these lines, you go to the Access forum. You will find a lot of SQL experience over there, while I'm kind of teaching myself as I go.
Those are not my field names. This is a linked table from another database, so those field names were not made by me. Trust me i know how hard it is to work with them.
Killer,
The code that you gave me worked great thank you !
The code that you gave me worked great thank you !
Hooray! A win for the VB forum. :)
I'm actually learning quite a bit about SQL just from attempting to answer these sort of questions.
Anyway, I'm glad we were able to help.
(Keep in mind, that's just one possible solution. It might be a good idea to go paste your current code into the Access forum and ask whether there's a better way.)
Hooray! A win for the VB forum. :)
I'm actually learning quite a bit about SQL just from attempting to answer these sort of questions.
Anyway, I'm glad we were able to help.
(Keep in mind, that's just one possible solution. It might be a good idea to go paste your current code into the Access forum and ask whether there's a better way.)
Well good we are both learning something :) I am slowly but surely learning a great deal from this site thanks to people like you :)
Well good we are both learning something :) I am slowly but surely learning a great deal from this site thanks to people like you :)
That's the great thing about a forum like this - it's a two-way affair. You also learn while answering questions, not just asking them.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Alex |
last post by:
I need an Epic Editor substitute. I tried XML Spy and it does not
meet my needs. I can't afford Epic Editor multi-user license at the
moment and I need to render a proof-of-concept for a...
|
by: Phil Stanton |
last post by:
Yes I know it can't be done in an editable form - well maybe not.
Assuming I have a report textbox with CanShrink and CanGrow set to yes, is
ther any way of calculating the length the textbox...
|
by: kelly.pearson |
last post by:
I had some access 97 reports that I used to publish to MS Word that
worked before we upgraded to Access 2K and Word 2K. Although there
were some minor discrepancies, I was able to tweak the access...
|
by: Roger Zaugg |
last post by:
I've got a question about C# together with MS Word 2003.
I've got a C# applikation and I want to write any data into
Word. But how I can position this text without linebreaks.
I think it should...
|
by: southoz |
last post by:
Good ay all ,
I'm fairly new to access(a little over 5 weeks now). Since I'v started I have picked up a lot of useful information from forums such as this and in doing so will share that information...
|
by: avi1000 |
last post by:
Hi
I want to do something with microsoft Word spell check and I wanted to know if it's possible.
I have a TextBox and I want to check the word in the textbox with the help of Word spellcheck.
I...
|
by: raghulvarma |
last post by:
I have two textboxes one contains a set of words and the property of that textbox is set to multipleline and the other one is the place where the user will have to type the word to be searched.
...
|
by: sury |
last post by:
I want to split a word into individual alphabets and substitute a word for each of the alphabets in c#.
example:
If the word entered is LATE, the output wud be
L:London
A :Apple
T:Tom
E:Egg
|
by: darith |
last post by:
Hi all, I want to know code in vb.net to get number of selected text in MS Word.
how can we write? Please help me. I need it urgent.
in textbox we just write textbox.selectedtext so we can get...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |