A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to place values in field depending on choice



 
 
Thread Tools Display Modes
  #1  
Old May 1st, 2004, 02:34 AM
MAC
external usenet poster
 
Posts: n/a
Default How to place values in field depending on choice

Hello:

I'd really appreciate your assistance in the following: I have a table with
3 columns and 5 rows. It relates to students' meal plans. They need to know
the full amounth they're paying depending on the plan. It looks like this:

Choice Group A Group B

Light $ 2,250.00 $
1,600.00

Small $ 2,475.00 $
1,825.00

Regular $ 2,675.00 $
2,025.00

Large $ 2,875.00 $
2,225.00

X-Large $ 3,075.00 $
2,425.00



I'm thinking of having a form with checkboxes for each one of options.
Then, depending on the choice, I need to have the value inserted in a
predefined field called mealexp. A calculated field with a long formula
would be impractical. What would be the best way of doing this, and how?



Any assistance would greatly appreciated!


  #2  
Old May 1st, 2004, 03:54 AM
Duane Hookom
external usenet poster
 
Posts: n/a
Default How to place values in field depending on choice

I would change the table structure to remove data from the field names
(Group A and Group B). A more flexible structure would be:
PlanID autonumber PK
Choice
Group
Price
Then, you could either store the PlanID or lookup and store the Price.

--
Duane Hookom
MS Access MVP


"MAC" wrote in message
.. .
Hello:

I'd really appreciate your assistance in the following: I have a table

with
3 columns and 5 rows. It relates to students' meal plans. They need to

know
the full amounth they're paying depending on the plan. It looks like

this:

Choice Group A Group B

Light $ 2,250.00 $
1,600.00

Small $ 2,475.00 $
1,825.00

Regular $ 2,675.00 $
2,025.00

Large $ 2,875.00 $
2,225.00

X-Large $ 3,075.00 $
2,425.00



I'm thinking of having a form with checkboxes for each one of options.
Then, depending on the choice, I need to have the value inserted in a
predefined field called mealexp. A calculated field with a long formula
would be impractical. What would be the best way of doing this, and how?



Any assistance would greatly appreciated!




  #3  
Old May 1st, 2004, 04:32 AM
MAC
external usenet poster
 
Posts: n/a
Default How to place values in field depending on choice

Sorry, Duane, but what do you mean by "store" and "lookup"? I'm devouring
the books on Access but haven't got this yet. Please explain. If it's too
lengthy to explain, any place I could read? Thank you very much!


I would change the table structure to remove data from the field names
(Group A and Group B). A more flexible structure would be:
PlanID autonumber PK
Choice
Group
Price
Then, you could either store the PlanID or lookup and store the Price.

--
Duane Hookom
MS Access MVP



  #4  
Old May 1st, 2004, 04:58 AM
Duane Hookom
external usenet poster
 
Posts: n/a
Default How to place values in field depending on choice

The Orders Subform in Northwind has a Product dropdown box that finds the
UnitPrice based on the ProductID and inserts it into a field. I don't care
for their method but it works. Their code with some extra lines removed:
Private Sub ProductID_AfterUpdate()
Dim strFilter As String
' Evaluate filter before it's passed to DLookup function.
strFilter = "ProductID = " & Me!ProductID
' Look up product's unit price and assign it to UnitPrice control.
Me!UnitPrice = DLookup("UnitPrice", "Products", strFilter)
End Sub

I would rather place the UnitPrice field in the dropdown and use code in the
after update:
Private Sub ProductID_AfterUpdate()
Me!UnitPrice = Me.ProductID.Column(2)
End Sub

--
Duane Hookom
MS Access MVP


"MAC" wrote in message
news
Sorry, Duane, but what do you mean by "store" and "lookup"? I'm devouring
the books on Access but haven't got this yet. Please explain. If it's
too
lengthy to explain, any place I could read? Thank you very much!


I would change the table structure to remove data from the field names
(Group A and Group B). A more flexible structure would be:
PlanID autonumber PK
Choice
Group
Price
Then, you could either store the PlanID or lookup and store the Price.

--
Duane Hookom
MS Access MVP





 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.