How-To:Create input form of products sold vs year

  • Thread starter Thread starter crsanders
  • Start date Start date
C

crsanders

I'm creating a database to track upcoming worldwide rocket launches and I
just can't seem to figure out how to creat a form that allows me to easily
input how many launches of each rocket there will be for the next 10 years.
In excel, it's easy, it would look like :

Rocket Type 2008 2009 2010 2011 ... etc
Atlas 7 8 6 7
Delta 4 5 4 6
Space Shuttle 5 4 3 0
etc

The associated table must look like
Atlas 2008 7
Atlas 2009 8
Atlas 2010 6
and so on ...

But I want to be able to enter that data without having to repeat entering
each vehicle name and using a form that looks like the simple table the top
but I'm struggling on how to set a form up that does this for me.

I searched for a similar thing in the Northwind sample database but came up
empty, most of the forms there are for either entering a single order or
summarizing already entered orders.

Anyone help would be greatly appreciated, especially if there is a working
example I could steal shamelssly :-)

thanks
 
Use this code behind the textbox that holds your rocket types. If you enter
Atlas, for instance, then Atlas will automatically be entered in the field
each time you create a new record, until you either

Close your form

or

Manually edit the field. For example, if you change it from Atlas to Redstone,
then each new record thereafter will have Redstone entered.

'xxxxx Code xxxx
Private Sub RocketType_AfterUpdate()
If Not IsNull(Me.RocketType) Then
RocketType.DefaultValue = """" & Me.RocketType & """"
End If
End Sub

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
Hmmm, not sure I fully understand, but I'll give it a try tomorrow and let
you know how it goes

thanks so much for the quick response
 
Too cool, this is working great, somehow I figured out how to make it happen,
but I then ran into another "crossroad" where I'm struggling with the
decision I have to make next.

Remember I want to enter 10 years worth of launches for each rocket in one
step. The code you have given me allows the form to leave the input value for
the vehicle constant while I enter multiple years and launches for each year,
one year at a time. If I want to enter 10 years worth of launches for that
one vehicle, then I need to do one of two things in the table design
regarding fields. Either have one field called year and one field called
num_launches, and then somehow figure out on the form how to have it keep
track of 10 pairs of these at one time of entry (seems hard) or have 10
fields of year (eg year_1, year_2, ... year_10) and 10 associated
num_launches fields (num_launches_y1, num_launches_y2, ... num_launches_y10).
I could then simply set the default values for year_1 to 2008, year_2 to
2009, etc and then next year incremenet them when I do a new forecast. That
way I don't have to re-input the years each time I enter a new vehicle's name
and num_launches values for each year. This 2nd option with multiple fileds
per year seems easier to execute but then I guess I really need to consider
how I will use the data/table later to make tables and graphs summarizing the
data. Seems like summing up one vehicles launches should be easy as a new
field summing up the individual year fields and summing up launches across
vehciles would be done with a crosstab query. Soooo, I guess I'm convincing
myself the more elaborate table design with mutiple year and num_launches
fields is best.

Do you agree ? It helps to bounce these ideas off someone before committing
to the time to make it happen so I appreciate your opinion here. Thanks so
much again for your help.
 

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