get data from another form object, then re-output

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Alright, I'm fed up. I can't do it with Macros (too limited), I can't do it
with VBA (can't output data from what I understand), and my . What I'm trying
to do is capture the input of my main form's data, in my case, the province
selected, then use that to decide if my Provincial Sale Tax column in my
subform will have a money value of the Price * 0.08 (or 8%). It's currently
sitting in the Subform's "Price" field as an "AfterUpdate" event.


Iif(Forms![WorkOrderForm]![Province]="ON",
Forms![WorkOrderSubform]![PST]=Forms![WorkOrderSubform]![Price] * 0.08,
Forms![WorkOrderSubform]![PST] = 0)
 
Alright, I'm fed up. I can't do it with Macros (too limited), I can't do it
with VBA (can't output data from what I understand)

Your understanding is in error. You certainly can do output from VBA.
, and my . What I'm trying
to do is capture the input of my main form's data, in my case, the province
selected, then use that to decide if my Provincial Sale Tax column in my
subform will have a money value of the Price * 0.08 (or 8%). It's currently
sitting in the Subform's "Price" field as an "AfterUpdate" event.


Iif(Forms![WorkOrderForm]![Province]="ON",
Forms![WorkOrderSubform]![PST]=Forms![WorkOrderSubform]![Price] * 0.08,
Forms![WorkOrderSubform]![PST] = 0)

The trouble here is that IIF can return VALUES - you're trying to get
it to actually perform an action. No can do!

Try instead:

Private Sub Price_AfterUpdate()
If Me!Province = "OR" Then
Me!PST = Me!Price * 0.08
Else
Me!PST = 0
End If
End Sub

Perhaps better - since the legislature is in session - would be to
have a small table with two fields: Province and TaxRate. Your PST
field would then cease to be needed, as you could calculate it on
demand in a Query, joining your sales table to the Tax Rate table by
Province, and putting a calculated field in the query

PST: [Price] * [TaxRate]

John W. Vinson[MVP]
 

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

Back
Top