I am trying to create a Recordset using a SQL statement. I've done it before but, this time, it seems the SQL statement isn't finding the Table in the db so, it has an empty value for the Recordset.
Help please? What am I missing?
Help please? What am I missing?
Code:
Private Sub cmdAddToReq_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim MPL As AccessObject
Dim strSQL As String
Dim strTower As String
Dim strProg As String
Dim strProj As String
Dim strProjV As String
Dim strOM As String
Dim strFund As String
Dim strRecNo As String
strSQL = "SELECT MPL.Tower, MPL.Program_Name, MPL.Project_Name, MPL.Project_Version, MPL.Offering_Manager, MPL.Funding_Source, MPL.Record_No FROM MPL WHERE (((MPL.Record_No)=[Forms]![Req_Add_Project]![Record_No]));"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
rst.MoveFirst
strTower = rst![Tower]
strProg = rst![Program_Name]
strProj = rst![Project_Name]
strProjV = rst![Project_Version]
strOM = rst![Offering_Manager]
strFund = rst![Funding_Source]
strRecNo = rst![Record_No]
Forms![Requirements Management]![Tower] = strTower
Forms![Requirements Management]![Program_Name] = strProg
Forms![Requirements Management]![Project_Name] = strProj
Forms![Requirements Management]![roject_Version] = strProjV
Forms![Requirements Management]![Offering_Manager] = strOM
Forms![Requirements Management]![Funding_Source] = strFund
Forms![Requirements Management]![Record_No] = strRecNo
rst.Close
End Sub