M
mj
Hi. I have a table and a query. I'm using some values from
the query name to increase values in the table. My code
looks like this:
Dim db As DAO.Database
Dim rsISDPulmonary As DAO.Recordset
Dim rsShippedToPlan As DAO.Recordset
Set db = CurrentDb
'This part of the code finds territories that need to have
their plans increased. This part is fine.
Set rsISDPulmonary = db.OpenRecordset("SELECT * FROM
[tblShippedTerritoryTotalPulmonary]" _
& " WHERE [Territory] = 'IS*'")
If Not rsISDPulmonary.EOF Then
Do While Not rsISDPulmonary.EOF
'This part restricts the table that holds the plan data to
those territories that are going to get an increase.
Set rsShippedToPlan = db.OpenRecordset("SELECT * FROM
tblShippedToPlan " _
& "WHERE Territory = '" & rsISDPulmonary!Territory & "'")
rsShippedToPlan.Edit
'This is where I'm having trouble. I'm trying to add
rsISDPulmonary![LBDDollarsShipped] to what is already in
the table's rsShippedToPlan![LBDDollarsShipped] field, but
I think I'm setting it to zero by mistake or something.
Any thoughts on how to do this? Thanks for any
suggestions!!
rsShippedToPlan![LBDDollarsShipped] = rsShippedToPlan!
[LBDDollarsShipped] + rsISDPulmonary![LBDDollarsShipped]
rsShippedToPlan.Update
rsISDPulmonary.MoveNext
Loop
End If
the query name to increase values in the table. My code
looks like this:
Dim db As DAO.Database
Dim rsISDPulmonary As DAO.Recordset
Dim rsShippedToPlan As DAO.Recordset
Set db = CurrentDb
'This part of the code finds territories that need to have
their plans increased. This part is fine.
Set rsISDPulmonary = db.OpenRecordset("SELECT * FROM
[tblShippedTerritoryTotalPulmonary]" _
& " WHERE [Territory] = 'IS*'")
If Not rsISDPulmonary.EOF Then
Do While Not rsISDPulmonary.EOF
'This part restricts the table that holds the plan data to
those territories that are going to get an increase.
Set rsShippedToPlan = db.OpenRecordset("SELECT * FROM
tblShippedToPlan " _
& "WHERE Territory = '" & rsISDPulmonary!Territory & "'")
rsShippedToPlan.Edit
'This is where I'm having trouble. I'm trying to add
rsISDPulmonary![LBDDollarsShipped] to what is already in
the table's rsShippedToPlan![LBDDollarsShipped] field, but
I think I'm setting it to zero by mistake or something.
Any thoughts on how to do this? Thanks for any
suggestions!!
rsShippedToPlan![LBDDollarsShipped] = rsShippedToPlan!
[LBDDollarsShipped] + rsISDPulmonary![LBDDollarsShipped]
rsShippedToPlan.Update
rsISDPulmonary.MoveNext
Loop
End If