Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too Few Parameters Expected

Status
Not open for further replies.

vix666

IS-IT--Management
Jul 17, 2003
63
AU
I currently have this code below which errors on the sql statement saying 'too few parameters expected 1', this should work as its only a simple query - im confused!

Any help would be much appreciated

Thanks in Advance

Vicky

Dim intRecordID As Integer
Dim db As Database
Dim rst As Recordset
Dim strSQL As String

intRecordID = Me.txt_recordid - 1

strSQL = "SELECT * FROM tbl_Availability_Target_Data " & _
"WHERE tbl_Availability_Target_Data.RecordID = intRecordID;"

Set db = CurrentDb()
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset)
 
Hi Vicky.

Since intRecordID is a variable, not a field, you must treat it differently:

strSQL = "SELECT * FROM tbl_Availability_Target_Data " & _
"WHERE RecordID = " & intRecordID & ";"

Hope this solves it.
MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Thanks very much, i had completely forgot about that, thats what happens when you do so many different kinds of work - you forget stuff!

Thanks again

Vicky
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top