Current Record

G

GB

I have a button on a form that when clicked does the following:

Private Sub Calculate_Price_Click()

DoCmd.RunCommand acCmdSaveRecord
Me.OrderDetailID.Requery

DoCmd.RunMacro "Price Calculation"

End Sub


Works fine BUT, when it runs the "Price Calculation" macro (a series of
queries) I'd like it to only perform the queries on the current record
(basically on the current order only). I want it to run on the current
"OrderID" only.

Do I have to change all the queries to run on CurrentRecord or is this
possible in code??!?!

Any help much appreciated, I've looked at the "Current Record" property in
the help files but don't really understand it... - just in case you haven't
guessed I'm new to this!!!
 
L

Larry Linson

The "current record" changes due to the Requery.

I don't do "macro answers" because I haven't used them in years except for
AutoExec and AutoKeys, so it wouldn't help me, but it's likely to be
difficult for _anyone_ to answer without knowing what the macro is/does.

At best, you may be able to move the macro call before the Requery. But that
may not be sufficient.

Larry Linson
Microsoft Access MVP
 
J

John Vinson

Works fine BUT, when it runs the "Price Calculation" macro (a series of
queries) I'd like it to only perform the queries on the current record
(basically on the current order only). I want it to run on the current
"OrderID" only.

Then you will need to edit each Query to use

=Forms!NameOfYourForm!OrderID

as a criterion on the OrderID field. "CurrentRecord" isn't useful in
this context - it merely refers to the volatile and non-permanent
record count of the currently open form's recordsource, and has no
meaning for any other table or query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top