Hi All,
I create afunction which takes on parameter & provides one output.
But now I need the same function to provide a two outputs but will take only one parameter/input.
How to go about doing it.
Please guide.
Regards
Sudhir
Hi All,
I create afunction which takes on parameter & provides one output.
But now I need the same function to provide a two outputs but will take only one parameter/input.
How to go about doing it.
Please guide.
Regards
Sudhir
We need more detail. What exactly are you trying to accomplish, and what is the code for the existing function?
-Randy Shea
I'm a programmer, but I'm also pro-grammar!
If your issue is resolved, please use Thread Tools to mark your thread as Solved!
PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003
I am giving 4 char code as input to the function.
The function in turn is running a query to my database & as per the code returning me the required data.
[VBA]
Sub Test()
dim Parnam as string
VCde = 1254
Parnam = ListName (VCde)
Msgbox Parnam
End Sub
Function ListName(Vencode As String) As String
Dim cn As ADODB.Connection, rs, rs2, rs3 As ADODB.Recordset
Dim CS As String
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=D:\Project\Data.mdb;"
'open a recordset
Set rs = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
'rs.Close
rs.Open "SELECT List.[Handler], List.[Type] FROM List WHERE (((List.VC)='" & Vencode & "')) ;", cn, adOpenStatic, adLockOptimistic
If rs.RecordCount > 0 Then
ListName = rs("Handler").Value
rs.Close
End If
End Function
[/VBA]
I want to provide the Type also in the output.
Regards
Sudhir
The Type of what? Are you referring to the data type of the returned value, or something within your table?I want to provide the Type also in the output.
-Randy Shea
I'm a programmer, but I'm also pro-grammar!
If your issue is resolved, please use Thread Tools to mark your thread as Solved!
PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003
[VBA]ListName = rs("Handler").Value & ":" & [type]
[/VBA]
Not sure about the Syntax, but you can Split the output in the original sub.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Its rs("type").value
So does that suffice?
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Or you could try:
[VBA]ListName = rs("Handler").Value & rs("Type").Value[/VBA]
-Randy Shea
I'm a programmer, but I'm also pro-grammar!
If your issue is resolved, please use Thread Tools to mark your thread as Solved!
PODA (Professional Office Developers Association) | Certifiable | MOS: Access 2003