Here's a trickey one

  • Thread starter Thread starter Spidey3721
  • Start date Start date
S

Spidey3721

I have a table of cost codes

tblCodes
CodeID
Name

There are two types of cost codes in the table. Main categories and
subdivisions to that category

Fruit
Apples
Pears
Plums


I have each CodeID that belongs to a main categories a unique identifer -
they all start with an "x"

CodeID for Fruit: x010
CodeID for Apples: 011
CodeID for Pears: 012
CodeID for Plums: 013

I now have a form, where I would like to be able to enter in costs for each
of these codes, however - I want the user to have the option of either:

1)Entering in a value for Fruit
2)Entering in values for apples, pears, plums and getting a total

I am trying to figure out a way to handle this, for if someone enters a
value for apples, then the Fruit value should be reset to zero
Whereas if someone enters a value for Fruit, then the apples, pears, and
plums values should all be reset to zero.

I am thinking that there might be a way to do this with option groups -
wondering if someone can at least point me in the right direction...
 
I think you're on the right track...I'd use an option group "Enter Main" and
"Enter Items" (or whatever terminology works for you), and then use two
subforms, one that allows just the main item to be displayed, and the other
that allows the individual items. You can set the Visible property of the
appropriate sub-form based on the choice in the option group.

HTH

--
Rebecca Riordan, MVP

Designing Relational Database Systems
Microsoft SQL Server 2000 Programming Step by Step
Microsoft ADO.NET Step by Step

http://www.microsoft.com/mspress

Blessed are they who can laugh at themselves,
for they shall never cease to be amused...
 
I guess the real challenge beyond that would be to find a way to
automatically zero out all subcategory costs if one enters a cost for the
main category, and vice versa
 
I'd do it in the BeforeUpdate -- depending on which subform is visible, zero
the others. But it rather depends on the business rules, doesn't it?

--
Rebecca Riordan, MVP

Designing Relational Database Systems
Microsoft SQL Server 2000 Programming Step by Step
Microsoft ADO.NET Step by Step

http://www.microsoft.com/mspress

Blessed are they who can laugh at themselves,
for they shall never cease to be amused...
 
Back
Top