Hello:
This is my first message, and my english is a little poor, sorry about
the inconvenience.
I'm writing code with Visual Basic for Applications. Platform is
Windows 2000, coding with Access 2000. I write the following sub:
[color=blue]
> Public Sub ObtainFieldAndV alue(ByVal st As String, ByVal sNew As String, _
> sf As String, sv As String)
> 'Here goes the code, a select in which values to sf and sv are assigned
> 'For example:
>
> Select Case TranslateTable( st)
> Case "TABLE1"
> sf = "FIELDS_NAM E"
> sv = ValueForField
> 'etc
> End Select
> End Sub[/color]
I don't declare that sf and sv are Byref, because I understand that
ByRef is the default, and not putting it it's the same that putting it
as ByRef.
After that Sub, I write another Function in which I call this,
ObtainFieldAndV alue. We get something like this:
[color=blue]
> Public Function DoSomething(ByV al sTable As String, ByVal sKey As String) As String
> Dim sField, sValue As String
>
> ObtainFieldValu e sTable, sKey, sField, sValue
>
> DoSomething = sField & " = " & sValue
> End Function[/color]
When I try to execute that function, I get this error message
(translated from spanish):
"Compilatio n error:"
"Type of ByRef argument doesn't match"
It marks the parameter sField on the line of the call to
ObtainFieldValu e as the error.
Questions are: what's the problem? what am I doing bad? what's
supposed to be the right way of doing it?
If you don't understand me, I'll try to be clearer (if I can).
Thanks anyway.
This is my first message, and my english is a little poor, sorry about
the inconvenience.
I'm writing code with Visual Basic for Applications. Platform is
Windows 2000, coding with Access 2000. I write the following sub:
[color=blue]
> Public Sub ObtainFieldAndV alue(ByVal st As String, ByVal sNew As String, _
> sf As String, sv As String)
> 'Here goes the code, a select in which values to sf and sv are assigned
> 'For example:
>
> Select Case TranslateTable( st)
> Case "TABLE1"
> sf = "FIELDS_NAM E"
> sv = ValueForField
> 'etc
> End Select
> End Sub[/color]
I don't declare that sf and sv are Byref, because I understand that
ByRef is the default, and not putting it it's the same that putting it
as ByRef.
After that Sub, I write another Function in which I call this,
ObtainFieldAndV alue. We get something like this:
[color=blue]
> Public Function DoSomething(ByV al sTable As String, ByVal sKey As String) As String
> Dim sField, sValue As String
>
> ObtainFieldValu e sTable, sKey, sField, sValue
>
> DoSomething = sField & " = " & sValue
> End Function[/color]
When I try to execute that function, I get this error message
(translated from spanish):
"Compilatio n error:"
"Type of ByRef argument doesn't match"
It marks the parameter sField on the line of the call to
ObtainFieldValu e as the error.
Questions are: what's the problem? what am I doing bad? what's
supposed to be the right way of doing it?
If you don't understand me, I'll try to be clearer (if I can).
Thanks anyway.
Comment