Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2004
    Location
    Tennessee
    Posts
    31

    Thumbs up Unanswered: Need help with tracking equipment use[RESOLVED]

    Hey all, I'm pretty new to VB and Access and am trying to figure out what I need to use (control wise) to track equipment usage for each record in an Access file as well as total use.

    I first thought that I'd just use a check box next to each type of equipment on my form, but now I can't figure out the coding to sum each type of equipment! Do I need to use some code for this? Ie.

    Code:
    Dim hospBed As Integar
    Dim wheChair As Integar
    etc... then add (+1) one each time the check box is enabled per record?!?


    Thanks in advance,


    G~
    Last edited by geneweaver; 12-25-04 at 02:02.
    The older I get, the more new stuff I tend to forget, the stuff I don't use any more...now that I remember!

    Mail Me

  2. #2
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    if each record can check out a wheelchair and bed, then check boxes work fine to let you know if one is checked out or not. you'll want to have it bound to a field in your table soit will retain the info, of course. to get a total, you make a query to count number of hospital beds and/or wheelchairs.

  3. #3
    Join Date
    Dec 2004
    Location
    Tennessee
    Posts
    31
    Thanks for the reply, my only problem with your solution; is that because the checkboxes are boolean data types I only get Yes & No's for my Query Sum. What I need is something (code perhaps) that will convert each records Yes to a 1 or a No to a 0.

    Any ideas?


    G~
    The older I get, the more new stuff I tend to forget, the stuff I don't use any more...now that I remember!

    Mail Me

  4. #4
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by geneweaver
    Thanks for the reply, my only problem with your solution; is that because the checkboxes are boolean data types I only get Yes & No's for my Query Sum. What I need is something (code perhaps) that will convert each records Yes to a 1 or a No to a 0.

    Any ideas?


    G~
    Hi geneweaver,
    Using the CheckBoxes you just Sum the amount like this:

    i.e. Field name [Rented] set as a CheckBox.
    In your Report/Form just do this in an Unbound TextBox

    =Sum([Rented])

    That will give you a Total of all that are Checked.

    have a nice one,
    BUD

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Gene.....btw

    I am a native Tennesseean myself...Memphis and Nashville... Just a transplant here in Texas...

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you could count([]) inplace of sum that way round you are protected against any changes in the underlying db storage format. Only the authors of the SQL engine no why they change things and when, whish is why you are recceomended by Microsoft to use the constants not the values of true / false

    You could generate a numeric value by using a conditional if in a query
    IIF([myBooleanField]=true,1,0)
    OR
    IIF([myBooleanField],1,0)

    But I suspect that your data model may be suspect, unless you can encapsualte every single possible item which the system may have to record. Even if you do I'd reccommend that you include some extras boolean columns just in case someone wants to add a few extra items to be tracked

    If you wanted to change the data model I'd suggets you split the rental table into 2, have one table which reprersnts the rental agreement (ie person or entity x started renting these on this date, paid by.......)
    then have a child table which identified the item(s) being rented

    and a third table which classified the items that could be rented, eg wheelchair, bed etc....
    You could include in htis some other code/ codes which will then allow for a classification of the type of item. eg type A are wheelchairs, where you may have electric, hand, lightwieght, 3 wheel etc..... Type B are Beds, where you may have height adjustable, on castors etc....... This would then allow the renter to check on their inventory (eg how many wheel cahirs do we have, on loan, by what type. when do we have a wheelchair of type x free). This may be a bit beyond the coursework brief but hey its Saturday who cares?
    HTH

  7. #7
    Join Date
    Dec 2004
    Location
    Tennessee
    Posts
    31

    Re: Need help with tracking equipment use [Resolved]

    Well, I finally figured it out! My problem was that I was forgetting that the boolean value for false=0 and true=-1.

    All I needed to do, was total the records for each column/heading then take the absolute value of the totals.

    Thanks again to all, for the advise.


    G~
    The older I get, the more new stuff I tend to forget, the stuff I don't use any more...now that I remember!

    Mail Me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •