Button to Advance Count in Field

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chris L

    Button to Advance Count in Field

    Greetings,
    I searched for this possibility without finding very much. It might be
    too simple ?

    In the simplest of terms, I need to place a button on a form, and have
    it advance the number in a field by one. In other words, a table has a
    field in which the default is 0. Click on the button, and the field
    changes its value to 2, do it again and it goes to 3, Etc.

    The above is a very simplified version of what I really need, though I
    probably can't get any more sophisticated than that without some
    examples of code to play with. I couldn't find anything like this in
    my current code anywhere.

    The Real goal someday: I have a Sales Order Form (seperate table for
    Sales Order and also seperate Sales Order Line Items table). When
    someone requests an item, and I happen to be out of stock and lose the
    sale, I would like to press a button on the Sales Order, that would
    Log a "Hit" on the Item selected, By advancing a number in the "Hits
    field" for the related item in my Inventory Table (also a seperate
    table now).

    I would then be able to display this growing "hits field" in various
    Forms and or Reports until the next time I review re-order
    information, easily SEEING how many times people have looked for the
    item and I did not have it.

    I would simply reset the field to Zero when I finally order the item,
    or maybe when it arrives and is checked in.

    In the future, One could automate some of the above, such as allowing
    the system to make the button visible only after inventory levels
    dropped to Zero, record the date that it hit Zero, and then Resets the
    information automatically after items have been received at check-in.

    If I can just get the simplest of the above, I would at least have
    something !

    Your input appreciated.

    Thanks,
    Chris L
  • Mark

    #2
    Re: Button to Advance Count in Field

    Chris,

    Say your textbox is named "Hits".

    Put the following code in the click event of a button:
    If IsNull(Me!Hits) Then
    Me!Hits = 0
    Else
    Me!Hits = Me!Hits + 1
    End If

    You don't have to have a default of 0. The first time ever you click the button,
    Hits will be 0. After that you will add 1 everytime you click the button.


    --
    PC Datasheet
    Your Resource For Help With Access, Excel And Word Applications
    resource@pcdata sheet.com


    "Chris L" <datac@lakefiel d.net> wrote in message
    news:7fddebf3.0 404230649.563be 529@posting.goo gle.com...[color=blue]
    > Greetings,
    > I searched for this possibility without finding very much. It might be
    > too simple ?
    >
    > In the simplest of terms, I need to place a button on a form, and have
    > it advance the number in a field by one. In other words, a table has a
    > field in which the default is 0. Click on the button, and the field
    > changes its value to 2, do it again and it goes to 3, Etc.
    >
    > The above is a very simplified version of what I really need, though I
    > probably can't get any more sophisticated than that without some
    > examples of code to play with. I couldn't find anything like this in
    > my current code anywhere.
    >
    > The Real goal someday: I have a Sales Order Form (seperate table for
    > Sales Order and also seperate Sales Order Line Items table). When
    > someone requests an item, and I happen to be out of stock and lose the
    > sale, I would like to press a button on the Sales Order, that would
    > Log a "Hit" on the Item selected, By advancing a number in the "Hits
    > field" for the related item in my Inventory Table (also a seperate
    > table now).
    >
    > I would then be able to display this growing "hits field" in various
    > Forms and or Reports until the next time I review re-order
    > information, easily SEEING how many times people have looked for the
    > item and I did not have it.
    >
    > I would simply reset the field to Zero when I finally order the item,
    > or maybe when it arrives and is checked in.
    >
    > In the future, One could automate some of the above, such as allowing
    > the system to make the button visible only after inventory levels
    > dropped to Zero, record the date that it hit Zero, and then Resets the
    > information automatically after items have been received at check-in.
    >
    > If I can just get the simplest of the above, I would at least have
    > something !
    >
    > Your input appreciated.
    >
    > Thanks,
    > Chris L[/color]


    Comment

    • Chris L

      #3
      Re: Button to Advance Count in Field

      "Mark" <mmorrow@earthl ink.net> wrote in message news:<Flaic.754 1$gH6.3290@news read3.news.atl. earthlink.net>. ..[color=blue]
      > Chris,
      >
      > Say your textbox is named "Hits".
      >
      > Put the following code in the click event of a button:
      > If IsNull(Me!Hits) Then
      > Me!Hits = 0
      > Else
      > Me!Hits = Me!Hits + 1
      > End If
      >
      > You don't have to have a default of 0. The first time ever you click the button,
      > Hits will be 0. After that you will add 1 everytime you click the button.[/color]

      Mark,
      Thanks! just what I needed to get a good start on this. Your code
      example allowed me to Get that Hit button and display in Sales Orders,
      Place a Hit Button and Display in Inventory, and, Place a Display, Hit
      button and "Reset" button In a Purchase Order Form.

      I wrestled without any results, getting the Reset button to overlay
      the hit button, showing the Reset button only when the qty was greater
      than 0. Hopefully I will get that working next week.

      Thanks again, as this really helped out.
      Chris Luebke

      Comment

      • Chris L

        #4
        Re: Button to Advance Count in Field

        datac@lakefield .net (Chris L) wrote in message news:[color=blue]
        > Mark,
        > Thanks! just what I needed to get a good start on this. Your code
        > example allowed me to Get that Hit button and display in Sales Orders,
        > Place a Hit Button and Display in Inventory, and, Place a Display, Hit
        > button and "Reset" button In a Purchase Order Form.
        >
        > I wrestled without any results, getting the Reset button to overlay
        > the hit button, showing the Reset button only when the qty was greater
        > than 0. Hopefully I will get that working next week.
        >
        > Thanks again, as this really helped out.[/color]

        Well, I came close anyhow. I have introduced a new problem.

        Just like I mention above, I have made it possible from a sales order
        to add a "hit", SEE the "hits" from a PO when the particular item is
        selected, and place a Clear "hits" button on the po as well.

        The problem is on the PO. I can not delete an item from the PO on the
        first try. It will delete on the second try, as if something isn't
        sequenced correctly when it comes to removing the line item.

        The "Hits" field is displayed in an existing subreport that contains
        other information about the Inventory Item Selected, and the "Clear
        hits" button is on the main form.

        Everything really works perfect, until I try to delete the Line item.
        Pressing a Delete button that uses:

        DoCmd.DoMenuIte m acFormbar, acEditMenu, , acMenuVer70

        Will remove the "qty on PO" (another field in that subform), but it
        takes another Delete button attempt to get the actual line item to
        disappear.

        Using a different delete button that exists down in the footer(uses
        acCmdDeleteReco rd) will occasionally give me the run-time error 3197 -
        another user is attempting to change the same data.... (Which is not
        the case).

        I have seen someone mention that this error can show up with a
        scenario like this (updating info in a subreport), but did not leave
        any options for repair.

        So, I am close. If anyone cares to point out some obvious things to
        check, I would be grateful.

        Thanks,
        Chris

        Comment

        Working...