Combining Information in tables and queries

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

Guest

I am trying to build a database where I can use a table or tables to access
information. What I would like to do is this....

Enter ticket names and cost in a table and set up a form to enter them in.
Using another form, I would like to record the daily cost of the ticket.
Using this form I would enter the date, select the ticket name from drop down
combo box, the cost should automatically be retrieved, I would enter the
quantity another box would automatically show the total. (Cost*Qty)

I can do all the computations, however I have not figured out how to develop
a combo box or drop down that would automatically retrieve the ticket cost
when I choose the ticket name.

I have some basic knowledge of access but need some advice.

Thanks,

Dana
 
Dana,
Use a query as the RowSource behind your combo, and you should have 2
columns in that query, TicketName and TicketPrice. Set the combo
NoOfColumns to 2, and give them both an appropriate CoulumnWidth.

The combo field should be bound (via the combo ControlSource property) to
the TicketName field in table behind your form, so that every time you
select a TicketName from the Combo, that value is stored in your TicketName
field.

Your TicketPrice Text control should be bound to the TicketPrice field of
the form's table.
Now, using the AfterUpdate event of the combo box you would use the
following event procedure code... or use a macro if that's easier... but in
code it would be... this

Private Sub TicketName_AfterUpdate
[TicketPrice] = [TicketName].Column(1)
End Sub

(Combo box columns are numbered 0, 1, 2, etc.., so (1) actually calls the
"second" column)

Every time you slect a TicketName, the Ticket Price from the second
column of your combo will be entered and strored in the TicketPrice field on
your form. Then, upon a Qty entry... your final cost calculation will
display.

hth
Al Camp
 
Back
Top