I'm having trouble getting an UPDATE query to pick up values from a recordset. When I run the code, I get parameter requests for the string values in the statement. When I go to Debug and hover over the string = rst![field] , it shows the value being picked up from the recordset but the SQL statement isn't picking it up. Could anyone let me know what I'm missing? Thanks in advance!
Private Sub cmdOpenMPLreport_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strSQLRST As String
Dim strRegionOrder As String
Dim strInScope As String
Dim Regions As AccessObject
Dim MPL_Report As AccessObject
strSQLRST = "SELECT RegionOrder, InScope FROM Regions;"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQLRST)
Do Until rst.EOF
strRegionOrder = rst![RegionOrder]
strInScope = rst![InScope]
strSQL = "UPDATE [MPL_Report] SET strRegionOrder = 'TBD' WHERE (((strRegionOrder)Is Null) AND ((strInScope)= Yes));"
DoCmd.RunSQL strSQL
rst.MoveNext
Loop
End Sub
Private Sub cmdOpenMPLreport_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strSQLRST As String
Dim strRegionOrder As String
Dim strInScope As String
Dim Regions As AccessObject
Dim MPL_Report As AccessObject
strSQLRST = "SELECT RegionOrder, InScope FROM Regions;"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQLRST)
Do Until rst.EOF
strRegionOrder = rst![RegionOrder]
strInScope = rst![InScope]
strSQL = "UPDATE [MPL_Report] SET strRegionOrder = 'TBD' WHERE (((strRegionOrder)Is Null) AND ((strInScope)= Yes));"
DoCmd.RunSQL strSQL
rst.MoveNext
Loop
End Sub