By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 759 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

Too few parameters

P: n/a
Hello all,
On running this code below I get the errmsg: Too few parameters. Expected :
1
[Emailadres] is an existing field in a linked table.
Can anybody see what I do wrong here?
Many thanks
Ronny

Dim dbsMyCheckBase As Database
Dim rst2 As DAO.Recordset
Set dbsMyCheckBase = OpenDatabase("MyPath\MyFile.mdb")
Dim sCheckVar As String
sCheckVar = Nz(Trim(ObjXL.Cells(nRow, nEmailadres).Value))
strSQL = "select * from tblDhscmails where [Emailadres] = sCheckVar"
Set rst2 = dbsMyCheckBase.OpenRecordset(strSQL) '<------------ ERROR LINE
nHowMuchRecs = rst2.RecordCount
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Sun, 2 May 2004 20:53:07 +0200, "Ronny Sigo"
<ro********@skyynet.be> wrote:
Change your code to:
strSQL = "select * from tblDhscmails where [Emailadres] = '" &
sCheckVar & "'"

Otherwise it is looking for the emailaddress "sCheckVar" rather than
"bi***@microsoft.com"
Also note I put a single quote around the email address: that way the
query processor knows it's dealing with a string.

-Tom.

Hello all,
On running this code below I get the errmsg: Too few parameters. Expected :
1
[Emailadres] is an existing field in a linked table.
Can anybody see what I do wrong here?
Many thanks
Ronny

Dim dbsMyCheckBase As Database
Dim rst2 As DAO.Recordset
Set dbsMyCheckBase = OpenDatabase("MyPath\MyFile.mdb")
Dim sCheckVar As String
sCheckVar = Nz(Trim(ObjXL.Cells(nRow, nEmailadres).Value))
strSQL = "select * from tblDhscmails where [Emailadres] = sCheckVar"
Set rst2 = dbsMyCheckBase.OpenRecordset(strSQL) '<------------ ERROR LINE
nHowMuchRecs = rst2.RecordCount


Nov 12 '05 #2

P: n/a
Thank you Tom, works great :)

"Tom van Stiphout" <to*****@no.spam.cox.net> schreef in bericht
news:0a********************************@4ax.com...
On Sun, 2 May 2004 20:53:07 +0200, "Ronny Sigo"
<ro********@skyynet.be> wrote:
Change your code to:
strSQL = "select * from tblDhscmails where [Emailadres] = '" &
sCheckVar & "'"

Otherwise it is looking for the emailaddress "sCheckVar" rather than
"bi***@microsoft.com"
Also note I put a single quote around the email address: that way the
query processor knows it's dealing with a string.

-Tom.

Hello all,
On running this code below I get the errmsg: Too few parameters. Expected :1
[Emailadres] is an existing field in a linked table.
Can anybody see what I do wrong here?
Many thanks
Ronny

Dim dbsMyCheckBase As Database
Dim rst2 As DAO.Recordset
Set dbsMyCheckBase = OpenDatabase("MyPath\MyFile.mdb")
Dim sCheckVar As String
sCheckVar = Nz(Trim(ObjXL.Cells(nRow, nEmailadres).Value))
strSQL = "select * from tblDhscmails where [Emailadres] = sCheckVar"
Set rst2 = dbsMyCheckBase.OpenRecordset(strSQL) '<------------ ERROR LINE
nHowMuchRecs = rst2.RecordCount


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.