Friday, February 24, 2012

custom code: [BC30205]

I'm trying to get the following custom code to work but get the error:
"There is an error on line 3 of custom code: [BC30205] End of statement
expected."
I really don't see it, but then I am new to this, so any help would be
appreciated...
Public Shared Function SetBgColor(ByVal Value1 As String, ByVal Value2
As String) As String
If Value1 = "Overdue" And Value2 Like "*" Then
SetBgColor = "DarkGray"
ElseIf Value1 "Open" And Value2 Like "*Antivirus*" Then
SetBgColor = "Silver"
Else
SetBgColor = "White"
End If
End Function
In the Expression for BackgroundColor I have:
=Code.SetBgColor(Fields!Status.Value,Fields!Type.Value)you might try single quotes instead of double quotes
"d4" <d4mann@.gmail.com> wrote in message
news:1154530967.090464.150580@.i42g2000cwa.googlegroups.com...
> I'm trying to get the following custom code to work but get the error:
> "There is an error on line 3 of custom code: [BC30205] End of statement
> expected."
> I really don't see it, but then I am new to this, so any help would be
> appreciated...
> Public Shared Function SetBgColor(ByVal Value1 As String, ByVal Value2
> As String) As String
> If Value1 = "Overdue" And Value2 Like "*" Then
> SetBgColor = "DarkGray"
> ElseIf Value1 "Open" And Value2 Like "*Antivirus*" Then
> SetBgColor = "Silver"
> Else
> SetBgColor = "White"
> End If
> End Function
> In the Expression for BackgroundColor I have:
> =Code.SetBgColor(Fields!Status.Value,Fields!Type.Value)
>|||and a question to you. If I wanted to use something like that, where would
I put it? I am new at this.
"d4" <d4mann@.gmail.com> wrote in message
news:1154530967.090464.150580@.i42g2000cwa.googlegroups.com...
> I'm trying to get the following custom code to work but get the error:
> "There is an error on line 3 of custom code: [BC30205] End of statement
> expected."
> I really don't see it, but then I am new to this, so any help would be
> appreciated...
> Public Shared Function SetBgColor(ByVal Value1 As String, ByVal Value2
> As String) As String
> If Value1 = "Overdue" And Value2 Like "*" Then
> SetBgColor = "DarkGray"
> ElseIf Value1 "Open" And Value2 Like "*Antivirus*" Then
> SetBgColor = "Silver"
> Else
> SetBgColor = "White"
> End If
> End Function
> In the Expression for BackgroundColor I have:
> =Code.SetBgColor(Fields!Status.Value,Fields!Type.Value)
>|||No good.
Public Shared Function SetBgColor(ByVal Value1 As String, ByVal Value2
As String) As String
If Value1 = 'Overdue' And Value2 Like '*' Then
SetBgColor = 'DarkGray'
ElseIf Value1 'Open' And Value2 Like '*Antivirus*' Then
SetBgColor = 'Silver'
Else
SetBgColor = 'White'
End If
End Function
I get - There is an error on line 1 of custom code: [BC30201]
Expression expected.|||You are missing an equals sign after the elseif.
Public Shared Function SetBgColor(ByVal Value1 As String, ByVal Value2
As String) As String
If Value1 = "Overdue" And Value2 Like "*" Then
SetBgColor = "DarkGray"
ElseIf Value1 = "Open" And Value2 Like "*Antivirus*" Then
SetBgColor = "Silver"
Else
SetBgColor = "White"
End If
End Function
d4 wrote:
> I'm trying to get the following custom code to work but get the error:
> "There is an error on line 3 of custom code: [BC30205] End of statement
> expected."
> I really don't see it, but then I am new to this, so any help would be
> appreciated...
> Public Shared Function SetBgColor(ByVal Value1 As String, ByVal Value2
> As String) As String
> If Value1 = "Overdue" And Value2 Like "*" Then
> SetBgColor = "DarkGray"
> ElseIf Value1 "Open" And Value2 Like "*Antivirus*" Then
> SetBgColor = "Silver"
> Else
> SetBgColor = "White"
> End If
> End Function
> In the Expression for BackgroundColor I have:
> =Code.SetBgColor(Fields!Status.Value,Fields!Type.Value)|||Doh! Its always the simple things. Sorry I overlooked it. Hate it when
you stare at something so hard and can't see it! Works now, thanks.|||I dont know enough about these to really be giving advice, but should there
be a space between end and if? Not sure.
"d4" <d4mann@.gmail.com> wrote in message
news:1154534398.002010.56110@.m79g2000cwm.googlegroups.com...
> No good.
> Public Shared Function SetBgColor(ByVal Value1 As String, ByVal Value2
> As String) As String
> If Value1 = 'Overdue' And Value2 Like '*' Then
> SetBgColor = 'DarkGray'
> ElseIf Value1 'Open' And Value2 Like '*Antivirus*' Then
> SetBgColor = 'Silver'
> Else
> SetBgColor = 'White'
> End If
> End Function
> I get - There is an error on line 1 of custom code: [BC30201]
> Expression expected.
>|||It's no problem. I usually just paste the stuff into a VS2003 VB App
and let it tell me where things are wrong (if i can't find it).
Regards,
Dan
d4 wrote:
> Doh! Its always the simple things. Sorry I overlooked it. Hate it when
> you stare at something so hard and can't see it! Works now, thanks.|||If what you show is exactly how your custom code is written, it looks
like you're missing an equal sign between Value1 and "Open" in your
ElseIf line. If that's not it, I don't see a problem (but then again
I'm a SQL guy, not VB). Good luck
toolman
d4 wrote:
> I'm trying to get the following custom code to work but get the error:
> "There is an error on line 3 of custom code: [BC30205] End of statement
> expected."
> I really don't see it, but then I am new to this, so any help would be
> appreciated...
> Public Shared Function SetBgColor(ByVal Value1 As String, ByVal Value2
> As String) As String
> If Value1 = "Overdue" And Value2 Like "*" Then
> SetBgColor = "DarkGray"
> ElseIf Value1 "Open" And Value2 Like "*Antivirus*" Then
> SetBgColor = "Silver"
> Else
> SetBgColor = "White"
> End If
> End Function
> In the Expression for BackgroundColor I have:
> =Code.SetBgColor(Fields!Status.Value,Fields!Type.Value)

No comments:

Post a Comment