|
-
May 3rd, 2005, 09:33 PM
#1
Thread Starter
PowerPoster
Add Text To String
My brain has gone blank.
EntryRiskText (string variable) can either be Low, Med or High so depending on it's value, LowRiskCounter, MedRiskCounter or HighRiskCounter is checked. My problem is the 2nd line which returns an "Expected: expression" error and the first "&" is highlighted.
Can anyone help me out?
VB Code:
If EntryRiskText & "RiskCounter" <> 10 Then
EntryRiskText & "RiskCounter" = EntryRiskText & "RiskCounter" + 1
End if
[B]
Last edited by lintz; May 3rd, 2005 at 09:44 PM.
-
May 3rd, 2005, 09:35 PM
#2
Re: Add Text To String
VB Code:
EntryRiskText = EntryRiskText + 1 & "RiskCounter"
that what you need?
-
May 3rd, 2005, 09:41 PM
#3
Re: Add Text To String
EntryRiskText is a String data type, and your concantinating it with an Integer (guess) and then evaluating it ??????
VB Code:
If EntryRiskText & "RiskCounter" <> 10 Then
Should it be something like:
VB Code:
If (EntryRiskText = "Med") And (RiskCounter <> 10) Then
Bruce.
Last edited by Bruce Fox; May 3rd, 2005 at 09:47 PM.
-
May 3rd, 2005, 09:41 PM
#4
Re: Add Text To String
 Originally Posted by lintz
My brain has gone blank.
EntryRiskText (string variable) can either be Low, Med or High so depending on it's value, LowRiskCounter, MedRiskCounter or HighRiskCounter is checked. My problem is the 2nd line which returns an "Expected: expression" error and the first "&" is highlighted.
Can anyone help me out?
VB Code:
If EntryRiskText & "RiskCounter" <> 10 Then
EntryRiskText & "RiskCounter" = EntryRiskText & "RiskCounter" + 1
End if
[B]
You need to do something else. You have no variable to add a value to.
You would need something like this:
VB Code:
If LowRiskCounter.value = 1 then
eVal = 2
end if
if MedRiskCounter.value = 1 then
eVal = eVal + 5
end if
if HighRiskCounter.value = 1 then
eval = eVal + 8
end if
EntryRisk.Text = & "RiskCounter = " & eVal
-
May 3rd, 2005, 09:42 PM
#5
Thread Starter
PowerPoster
Re: Add Text To String
Not quite.
If EntryRiskText = Low then the second line should read:
LowRiskCounter = LowRiskCounter +1
but instead of hard coding the Low (or Med/High) I use the varaible EntryRiskText
EDIT: I posted to the first reply but have now read the others. Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|