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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error: No value given for one or more params

Status
Not open for further replies.

frogmann

Programmer
Apr 17, 2007
28
US
Hello, I receive the following error:
Run-time error '-2147217904 (80040e10)': No value given for one or more required parameters
when running the following code:
Set rs1 = db.OpenRecordset("SELECT * FROM tblNewStudentLog")
Do
rs1.MoveFirst

sql1 = "SELECT tblStudent.StudID, tblStudent.HousingNum, tblStudent.PID, tblStudent.FName, tblStudent.LName, tblStudent.City, " & _
"tblStates.Abrv AS State, tblStudent.Zip, tblStudent.Suffix, tblStudent.Address, tblStudent.address2, tblStudent.RefID, " & _
"tblStudent.StatusID, tblStudent.StateID, tblInstitution.Institution FROM (tblStudent LEFT JOIN tblStates " & _
"ON tblStudent.StateID = tblStates.StateID) LEFT JOIN tblInstitution ON tblStudent.InstutID = " & _
"tblInstitution.InstutID WHERE (((tblStudent.PID)=" & _
"" & rs1![PID] & ") AND ((tblStudent.FName)= " & SQLFixup(rs1![FName]) & "));"

rs3.Open sql1, Application.CurrentProject.Connection, adOpenStatic, adLockPessimistic

[rest of code]...

The funny thing is the correct values for rs1![PID] and rs1![FName] are showing in debug mode, and I can also run the sql statement alone just fine using these values, verifying that all column/field headings are spelled correctly.
Any suggestions would be very welcome, I've never received this error before. Thanks!
 
Try
Code:
sql1 = "SELECT tblStudent.StudID, tblStudent.HousingNum, tblStudent.PID, tblStudent.FName, tblStudent.LName, tblStudent.City, " & _
    "tblStates.Abrv AS State, tblStudent.Zip, tblStudent.Suffix, tblStudent.Address, tblStudent.address2, tblStudent.RefID, " & _
    "tblStudent.StatusID, tblStudent.StateID, tblInstitution.Institution FROM (tblStudent LEFT JOIN tblStates " & _
    "ON tblStudent.StateID = tblStates.StateID) LEFT JOIN tblInstitution ON tblStudent.InstutID = " & _
    "tblInstitution.InstutID WHERE (((tblStudent.PID)=" & _
     rs1![PID] & ") AND ((tblStudent.FName)= " & SQLFixup(rs1![FName]) & "));"
 
how about this

sql1 = "SELECT tblStudent.StudID, tblStudent.HousingNum, tblStudent.PID, tblStudent.FName, tblStudent.LName, tblStudent.City, " & _
"tblStates.Abrv AS State, tblStudent.Zip, tblStudent.Suffix, tblStudent.Address, tblStudent.address2, tblStudent.RefID, " & _
"tblStudent.StatusID, tblStudent.StateID, tblInstitution.Institution FROM (tblStudent LEFT JOIN tblStates " & _
"ON tblStudent.StateID = tblStates.StateID) LEFT JOIN tblInstitution ON tblStudent.InstutID = " & _
"tblInstitution.InstutID WHERE tblStudent.PID=" & _
rs1![PID] & " AND tblStudent.FName= '" & SQLFixup(rs1![FName]) & "';"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top