Not sure wher I should post this, so I put it here and under reports.
I have a table that lists date, current price, and product symbol. I use a form to track pertinent data of each product. The only part that ever changes is the current price. When the product form is opened to a specific product, I use a DAO recordset to look up and post the current price on the form. F1 is the symbol field and f2 is the current price.
VBA code:
stksubSql = "select [F2] from [CPTbl] where [F1] = " & "'" & _
Me![Symbol] & "'"
Set rstCurrent = CurrentDb.OpenRecordset(stksubSql, dbOpenDynaset)
If rstCurrent.EOF <> True Then
rstCurrent.MoveLast
x = rstCurrent.Fields(0)
Me!Current_Val = x
End If
This works fine. However, when I try to run a report of all products, the current prices have not been updated unless I completely step through each form manually to force the code to run on each product. CPTbl is automatically linked to a price sheet from the manufacturer.
Is there a way in code to have all records updated manually. I have very little VBA experience and am not sure of where to start.
Thanks for your help!
Bill
I have a table that lists date, current price, and product symbol. I use a form to track pertinent data of each product. The only part that ever changes is the current price. When the product form is opened to a specific product, I use a DAO recordset to look up and post the current price on the form. F1 is the symbol field and f2 is the current price.
VBA code:
stksubSql = "select [F2] from [CPTbl] where [F1] = " & "'" & _
Me![Symbol] & "'"
Set rstCurrent = CurrentDb.OpenRecordset(stksubSql, dbOpenDynaset)
If rstCurrent.EOF <> True Then
rstCurrent.MoveLast
x = rstCurrent.Fields(0)
Me!Current_Val = x
End If
This works fine. However, when I try to run a report of all products, the current prices have not been updated unless I completely step through each form manually to force the code to run on each product. CPTbl is automatically linked to a price sheet from the manufacturer.
Is there a way in code to have all records updated manually. I have very little VBA experience and am not sure of where to start.
Thanks for your help!
Bill