psyduck1085
Registered User.
- Local time
- Tomorrow, 02:45
- Joined
- Sep 18, 2013
- Messages
- 13
Hi All,
Please help, I get a run-time error 2147217904(80040e10) stated no value given for one or more required parameters.
Below are the VBA that i get to add new fuction in ms access.
Public Function Conc(Fieldx, Identity, Value, Source) As Variant
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim SQL As String
Dim vFld As Variant
Set cnn = New CurrentProject.Connection
Set rs = New ADODB.Recordset
vFld = Null
SQL = "SELECT [" & Fieldx & "] as Fld" & _
" FROM [" & Source & "]" & _
" WHERE [" & Identity & "]=" & Value
' open recordset.
rs.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly
' concatenate the field.
Do While Not rs.EOF
If Not IsNull(rs!Fld) Then
vFld = vFld & ", " & rs!Fld
End If
rs.MoveNext
Loop
' remove leading comma and space.
vFld = Mid(vFld, 3)
Set cnn = Nothing
Set rs = Nothing
' return concatenated string.
Conc = vFld
End Function
And my queries are as follow;
Field 1: Conc("T24 Reference","Counterparty",[Counterparty],"X-4_Reporting_Today")
And the error code point to
rs.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly
Can someone pls help to solve my issues!
Please help, I get a run-time error 2147217904(80040e10) stated no value given for one or more required parameters.
Below are the VBA that i get to add new fuction in ms access.
Public Function Conc(Fieldx, Identity, Value, Source) As Variant
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim SQL As String
Dim vFld As Variant
Set cnn = New CurrentProject.Connection
Set rs = New ADODB.Recordset
vFld = Null
SQL = "SELECT [" & Fieldx & "] as Fld" & _
" FROM [" & Source & "]" & _
" WHERE [" & Identity & "]=" & Value
' open recordset.
rs.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly
' concatenate the field.
Do While Not rs.EOF
If Not IsNull(rs!Fld) Then
vFld = vFld & ", " & rs!Fld
End If
rs.MoveNext
Loop
' remove leading comma and space.
vFld = Mid(vFld, 3)
Set cnn = Nothing
Set rs = Nothing
' return concatenated string.
Conc = vFld
End Function
And my queries are as follow;
Field 1: Conc("T24 Reference","Counterparty",[Counterparty],"X-4_Reporting_Today")
And the error code point to
rs.Open SQL, cnn, adOpenForwardOnly, adLockReadOnly
Can someone pls help to solve my issues!
Last edited: