Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset Recordset

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
US
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 think you can use a simple update query but we don't know your form's record source table and field names. It would also be important to describe your primary and foreign key fields.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top