VB Input Values to Appropriate Format

              -2 combo boxes  where one is user selected for a category and the other is used for choosing multiple subcategories if the user so chooses.

             -2 text boxes where one is for input of frequency (ie say for example you want to schedule something, like painting a building, every so many years, hence frequency) and the other textbox is cost per subcategory.  I need the cost to match the frequency in a datagrid perhaps because of my db.

 Example:   (assuming category is Building, subcats are paint, re-roof, frequency=every 3 yrs
                   cost of paint = 1500.00  and re-roof is 2000.00)

                              2004                2005              2006             2007                  2008        

             Paint          $1500.00                                                  $1500.00
             Re-Roof      $2000.00                                                  $2000.00

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LambersonSoftware EngineerCommented:
Set the table structure up something like this....

table name :  Maintenance
    fields :  BuildingID           MaintenanceType          Frequency         Date                      Cost
                1                           Paint                           3                       4/10/2004             1500
                1                           Re-Roof                      3                       4/10/2004              2000
                1                           Paint                           3                      4/10/2007              1500
                1                           Re-Roof                      3                       4/10/2007              2000

This way you won't be adding fields to your table and your queries will be much more managable.
All that is needed then is to open the table in code and add the information from the combo boxes to the recordset. Then if you want to display a grid of the information just use the recordset as the record source.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shanemcfAuthor Commented:
 if my customer table      =       CustomerID (PK)   type=number
          maintenance table =       BuildingID    (PK)   type=number
                                               CustomerID (FK)   type=number

   My i-face is to choose from combo boxes for customer and then category, then subcat...

How do I keep my customerid (pk)  the same as my customerid(fk) ???  There is no prompt for an ID.

Thanks in advance...
Bob LambersonSoftware EngineerCommented:
When you add records to the primary table (PK) add any records to the related table (FK) using the same key for both the PK and the FK.
You can do this in any sequece using the PK in the related table as a FK. If you get to a many to many relationship, you will need to have a seperate table that joins the tables with only the keys in it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.