Hi folks,
This code, with a hardwired value of "KORG" (numeric field in a table) works like expected:
m_SQL = "SELECT ORG, Campus_Dept, EMPID, LName, FName, Job_Title" _
& " FROM Input_from_Lawson" _
& " WHERE (KORG = 125)" _
& " ORDER BY Lname, Fname;"
Set m_Rs2 = m_Db1.OpenRecordset(m_SQL, dbOpenTable)
My dilemma is that I want to substitute a numeric variable whose value will change as a "While" loop executes. Here's the code that fails:
m_SQL = "SELECT ORG, Campus_Dept, EMPID, LName, FName, Job_Title" _
& " FROM Input_from_Lawson" _
& " WHERE (KORG = m_KORG)" _
& " ORDER BY Lname, Fname;"
Set m_Rs2 = m_Db1.OpenRecordset(m_SQL, dbOpenTable)
The m_KORG variable is dimensioned as LONG at the top of the routine, and is a Private variable.
I've done some Debug.Print statements and know that m_KORG is being populated with a correct value, but I when I run the routine, I get this error message:
SQRun-time error '3061': Too few parameters. Expected 1
Any thoughts ? All help gratefully accepted.
Hope all is well & till later,
Rick S.
San Antonio, TX