D
DoveArrow
When trying to run the following code, I get the error message "Too
few parameters. Expected 2."
Dim db As Database (I've also tried Dim db As DAO.Database, just in
case)
Dim rs As Recordset (I've also tried Dim rs As DAO.Recordset, just in
case)
Dim strSQL As String
strSQL = "SELECT jtblMajorSpecialization.SpecializationCode,
jtblMajorSpecialization.SpecializationRequirement,
jtblMajorSpecialization.[Specialization Description],
jtblMajorSpecialization.SpecializationTypeID FROM tblMajorRequirement
RIGHT JOIN jtblMajorSpecialization ON
tblMajorRequirement.MajorRequirement =
jtblMajorSpecialization.MajorRequirement WHERE
(((jtblMajorSpecialization.SpecializationTypeID)=1 Or
(jtblMajorSpecialization.SpecializationTypeID)=2) AND
((tblMajorRequirement.CatalogYear)=[Forms]![frmProgramChange]!
[CatalogYear]) AND ((tblMajorRequirement.Program)=[Forms]!
[frmProgramChange]![PrimaryMajor]));"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
Now I have tried creating a select query based off of my SQL
statement, and the query runs just fine. However, even if I try to use
my query as the recordset (see below), I still get the same error
message.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("qselMajorSpecialization", dbOpenDynaset)
If someone can please explain what is happening here, I would very
much appreciate it. Thanks.
few parameters. Expected 2."
Dim db As Database (I've also tried Dim db As DAO.Database, just in
case)
Dim rs As Recordset (I've also tried Dim rs As DAO.Recordset, just in
case)
Dim strSQL As String
strSQL = "SELECT jtblMajorSpecialization.SpecializationCode,
jtblMajorSpecialization.SpecializationRequirement,
jtblMajorSpecialization.[Specialization Description],
jtblMajorSpecialization.SpecializationTypeID FROM tblMajorRequirement
RIGHT JOIN jtblMajorSpecialization ON
tblMajorRequirement.MajorRequirement =
jtblMajorSpecialization.MajorRequirement WHERE
(((jtblMajorSpecialization.SpecializationTypeID)=1 Or
(jtblMajorSpecialization.SpecializationTypeID)=2) AND
((tblMajorRequirement.CatalogYear)=[Forms]![frmProgramChange]!
[CatalogYear]) AND ((tblMajorRequirement.Program)=[Forms]!
[frmProgramChange]![PrimaryMajor]));"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
Now I have tried creating a select query based off of my SQL
statement, and the query runs just fine. However, even if I try to use
my query as the recordset (see below), I still get the same error
message.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("qselMajorSpecialization", dbOpenDynaset)
If someone can please explain what is happening here, I would very
much appreciate it. Thanks.