Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing a ADODB.Recordset Field to a function.
Message
From
17/08/2001 13:56:14
 
 
To
13/08/2001 12:33:36
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00543095
Message ID:
00545533
Views:
20
It should be possible to pass an ADODB.Field object to the function. To test that this will work, try adding a:
Dim myField As New ADODB.Field

under the Dim MyRS.... Then add a:
Set myField = MyRS("PolicyNo")
or
Set myField = MyRS!PolicyNo

then pass this value to your function (WF()). Also, since MyString should be a string or variant (note return value of function WF()) you should not use the Set command. Instead try the following:
MyString = WF(myField)

This may help narrow down your problem. Also by specifying the .Value property of the field when looking at the value may help follow the code and make it compatible with the new VB.Net which eliminates default properties.

Hope this helps.

>Is it possible to pass an ADODB.Recordset Field to a function?
>
>Here is what I tried and I am getting a "Compile error: - ByRef argument type mismatch" error. I tried passing the "adoField" in by ref and get the same error.
>
>Dim MyRS As New ADODB.Recordset
>Set MyRS = New ADODB.Recordset
>
>... processing logic to put values into the "PolicyNo" field along with others...
>
>Set MyString = WF(MyRS("PolicyNo"))
>
>Private Function WF(adoField As ADODB.Field, TotalWidth As Integer) As String
> If adoField.Type = adNumeric Then
> WF = PadNumeric(adoField, TotalWidth)
> Else
> WF = PadSpaces(adoField, TotalWidth)
> End If
>End Function
>
>
>Thanking you in advance for your help.
John Davidson
Previous
Reply
Map
View

Click here to load this message in the networking platform