View Full Version : If Statement in Table


CGHolland
10-31-2007, 10:19 PM
Hello:

I'm working on a class assignment and I am in desperate need of help. I am trying to set up a table... the fields are as shown: Type of Registrant, Registration Fee, Number...

I've created another table that has a list of names, telephone numbers, amounts paid, and registration status...

I'm creating the table I talked about in the first paragraph to simply list the status of registration, the amount per registration status, and the total number of registrants per status...

The available registration types are as follows: Academic ($285), Student ($200), Executive ($300), Manager ($225)

What I would like is this: When entering my information in this new table, I would like for the registration fee to automatically appear... almost like a set value... So, if I entered "Academic" in the "Registration Type" field, the amount $285 would automatically appear. I've tried a few "if" statements, and they're not working in my favor... Is there any kind of code that will allow this to happen? Please keep in mind, the reigstration types from which the information would be pulled are in the form of a list box in another table... Thanks!

neileg
11-01-2007, 05:40 AM
You don't do this at table level. Tables are for storing data, forms are for entering data. I would use a combo box on a form to select it.

twoplustwo
11-01-2007, 09:37 AM
Hi Neil,

I agree.

OP,

Would this solution not be adequate?

Pat Hartman
11-10-2007, 01:37 PM
You can create a table that contains the registration types and their associated cost. Include the cost field in the RowSource for the combo but hide it. In the afterUpdate event of the combo, copy the cost to the registration table:

Me.RegistrationAmt = Me.RegistrationType.Column(1) <--- the columns of a combo's RowSource are a zero based array. Therefore .Column(1) actually refers to the second column of the RowSource.