No help for' Openrecordset' method

B

Brad Fuller

The following code:

Dim pt1 As Recordset, strRSName As String
strRSName = "Select [*] From Patients Where [PatID] = '" &
[PatID] & "'"
Set pt1 = curdb.OpenRecordset(strRSName, dbOpenDynaset)

when executed, gives the "too few parameters. Expected 1"
runtime error '3061' message.

when I highlight 'OpenRecordset' and press F1 key, no help
is displayed.

Why the error, and why is there no help displayed?

Thanks in advance
Brad
 
C

Cheryl Fischer

Hello Brad,

When I've seen the "too few parameters" error message, it has usually meant
that my SQL string could not be evaluated properly. Just a guess ... is
PatID a number field? If so, remove the quotes and try your SQL string as:

strRSName = "Select [*] From Patients Where [PatID] = " & [PatID]

hth,
 
J

John Spencer (MVP)

Try REMOVING the braces from around the asterisk. I think Access is trying to
treat this as a field name instead of "All Fields".

strRSName = "Select * From Patients Where [PatID] = '" & [PatID] & "'"

Cheryl said:
Hello Brad,

When I've seen the "too few parameters" error message, it has usually meant
that my SQL string could not be evaluated properly. Just a guess ... is
PatID a number field? If so, remove the quotes and try your SQL string as:

strRSName = "Select [*] From Patients Where [PatID] = " & [PatID]

hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Brad Fuller said:
The following code:

Dim pt1 As Recordset, strRSName As String
strRSName = "Select [*] From Patients Where [PatID] = '" &
[PatID] & "'"
Set pt1 = curdb.OpenRecordset(strRSName, dbOpenDynaset)

when executed, gives the "too few parameters. Expected 1"
runtime error '3061' message.

when I highlight 'OpenRecordset' and press F1 key, no help
is displayed.

Why the error, and why is there no help displayed?

Thanks in advance
Brad
 
B

Brad Fuller

Thanks for the suggestions. I also found that I was loading
references to both ADO and DAO and thereby confusing the
help for access 2000. Is there a benefit of ADO over DAO?
Brad
-----Original Message-----
Try REMOVING the braces from around the asterisk. I think Access is trying to
treat this as a field name instead of "All Fields".

strRSName = "Select * From Patients Where [PatID] = '" & [PatID] & "'"

Cheryl said:
Hello Brad,

When I've seen the "too few parameters" error message, it has usually meant
that my SQL string could not be evaluated properly. Just a guess ... is
PatID a number field? If so, remove the quotes and try your SQL string as:

strRSName = "Select [*] From Patients Where [PatID] = " & [PatID]

hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

Brad Fuller said:
The following code:

Dim pt1 As Recordset, strRSName As String
strRSName = "Select [*] From Patients Where [PatID] = '" &
[PatID] & "'"
Set pt1 = curdb.OpenRecordset(strRSName, dbOpenDynaset)

when executed, gives the "too few parameters. Expected 1"
runtime error '3061' message.

when I highlight 'OpenRecordset' and press F1 key, no help
is displayed.

Why the error, and why is there no help displayed?

Thanks in advance
Brad
.
 
R

Rod Kansick

Looks to me like your SQL statement terminiator is
missing. It should look like "Select [*] From Patients
Where [PatID] = '" & [PatID] & "';"

I use SQL statements all the tim instead of querydefs and
recordsets over tables, much nicer coding and consistency.
Hope this helps....

Regards
Rod
 
J

John Spencer (MVP)

In my opinion, in most cases you are better off with DAO. There are exceptions
and there are people that believe otherwise.

Brad said:
Thanks for the suggestions. I also found that I was loading
references to both ADO and DAO and thereby confusing the
help for access 2000. Is there a benefit of ADO over DAO?
Brad
-----Original Message-----
Try REMOVING the braces from around the asterisk. I think Access is trying to
treat this as a field name instead of "All Fields".

strRSName = "Select * From Patients Where [PatID] = '" & [PatID] & "'"

Cheryl said:
Hello Brad,

When I've seen the "too few parameters" error message, it has usually meant
that my SQL string could not be evaluated properly. Just a guess ... is
PatID a number field? If so, remove the quotes and try your SQL string as:

strRSName = "Select [*] From Patients Where [PatID] = " & [PatID]

hth,
--
Cheryl Fischer
Law/Sys Associates
Houston, TX

The following code:

Dim pt1 As Recordset, strRSName As String
strRSName = "Select [*] From Patients Where [PatID] = '" &
[PatID] & "'"
Set pt1 = curdb.OpenRecordset(strRSName, dbOpenDynaset)

when executed, gives the "too few parameters. Expected 1"
runtime error '3061' message.

when I highlight 'OpenRecordset' and press F1 key, no help
is displayed.

Why the error, and why is there no help displayed?

Thanks in advance
Brad
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top