Getting the error "...too few parameters expected 2"

  • Thread starter Thread starter The L&L Company
  • Start date Start date
T

The L&L Company

Guest
Can you guys help me here...this is the code that I am using. What am I doing wrong? I am using the code to populate a text box with a string of names instead of just one.

~ Joe

******************************
Private Sub Form_Load()
Dim rstAppts As Recordset
Dim PreviousName As String
Dim strName As String

Set rstAppts = CurrentDb.OpenRecordset("qryactivityentryscreen", dbOpenDynaset)
rstAppts.MoveFirst
strName = rstAppts("fullname")
PreviousName = strName
Do While Not rstAppts.EOF
If rstAppts("fullname") <> PreviousName And rstAppts("fullname") <> " " Then
strName = strName & " - " & rstAppts("fullname")
End If
PreviousName = rstAppts("fullname")
rstAppts.MoveNext
Loop

TxtConsultant.Text = strName

TxtStatusNote.SetFocus
Set rstAppts = Nothing
'rstAppts.Close

End Sub

[This message has been edited by The L&L Company (edited 06-11-2001).]
 
As soon as the form loads I get the error "...too few parameters...expected 2" I don't know how to fix it or even what the problem is. I get the error on the "Set Statement" It is weird because i spin through many other recordsets in other places and their syntax is exactly the same.

Help!

~ Joe
 
Are you sure you have the query name spelled right? Try putting another recordset in your code and see if that works... If it works, they it is a problem with your query. Can you open and view the query normally? Does the query have parameters?
 
im having the same exact problem, ive been trying to get around it for the past three days....

i have a function that makes the same exact call. it works in one database but not in the one im making now. i was wondering if it was office xp...

btw: line thats causing the error is:

Set rstAppts = CurrentDb.OpenRecordset("qryactivityentryscreen", dbOpenDynaset)
 
I modified your code for one of my practice forms. The errors I got were caused by the following. Type mismatch error on the SET line, to fix hit tools, references, then check the Microsoft DAO 3.* and move it above Microsoft ADO 2.* (if checked). The second error I had was my control source field on the underlying table was set to 20, I had to change it to 255. After I fixed those errors it worked fine. If those don't help, please post the recordsource for the form.

HTH
Robert
 
It won't let me add DAO 3.5 object library above dao 2.5/3.5 It says "...conflict with current library". I haven't had a chance to try the other solution yet.

Thanks,
~ Joe
 

Users who are viewing this thread

Back
Top Bottom