Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft Access > DLookup and VBA...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 30269 of 31596
Post > Topic >>

DLookup and VBA Queries

by "Keith Wilby" <here@[EMAIL PROTECTED] > May 15, 2008 at 10:27 AM

I have a DLookup field (DrgNo) in a query (qryItems) which is used in the 
attached (part) function.  The purpose of the function is to concatenate
the 
contents of a field in a query.  The arguments are passed to the function 
successfully but the code fails at the line

Set rs = db.OpenRecordset(strSQL)

with the error "Too few parameters, expected 1".

This function worked before I had to change the DrgNo field to a DLookup
and 
if I copy the contents of strSQL at run-time to a regular query it runs. 
Is 
this a DLookup issue or am I missing something else?

Many thanks.

Keith.

Public Function libConcatenate(lngID As Long, strSysCode As String) As 
String

Dim db As DAO.Database, rs As DAO.Recordset, strSQL As String, strResult
As 
String
Set db = CurrentDb

strSQL = "Select Item, DrgNo from qryItems where CertID = " & lngID & "
and 
[SysCode] = '" & strSysCode & "' order by Item"
Set rs = db.OpenRecordset(strSQL)

If rs.RecordCount = 0 Then Exit Function
 




 5 Posts in Topic:
DLookup and VBA Queries
"Keith Wilby" &  2008-05-15 10:27:27 
Re: DLookup and VBA Queries
Roger <lesperancer@[EM  2008-05-15 03:08:31 
Re: DLookup and VBA Queries
"Keith Wilby" &  2008-05-15 12:38:53 
Re: DLookup and VBA Queries
"Keith Wilby" &  2008-05-15 11:10:06 
Re: DLookup and VBA Queries
Roger <lesperancer@[EM  2008-05-15 03:14:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 11:46:38 CST 2008.