Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Dec 2003
    Location
    Virginia, USA
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Add/Delete button (XP or 2003)

    I have a relatively simple database. But in a form I want to be able to look up an item by its BAR CODE, this is working fine. Now the boss wants an ADD button to add to the inventory and a SUBTRACT button to remove items from inventory. In the form he also doesn't want any data edited...only the add/subtract buttons. It will work so if one hits the add button you then enter how many to add and it adds it to inventory and visa-versa for the subtract.
    <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>
    Any and all help is appreciated and I don't know VBS so I want to avoid that if at all possible.
    TIA!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Add/Delete button (XP or 2003)

    You can use the Command Box Wizard to create a command button that adds a single record, and another command button that deletes the current record. The Wizard will create the necessary code for you. But a button that adds a variable number of records requires some knowledge of VBA. If possible, I would stay with the button that adds one record.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Add/Delete button (XP or 2003)

    Do you want to add or remove records, or just adjust the quantity in stock of the current item, using the add subtract buttons.

    You can add stock using this code:

    Me!quantity = Me!quantity + Val(InputBox("Enter quantity to add.", "Add stock"))

    An input box prompts the user to enter something, as a piece of text. Val converts it to a number if it can.
    Regards
    John



  4. #4
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Add/Delete button (XP or 2003)

    Just curious - does this prevent data from being edited within the form?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Add/Delete button (XP or 2003)

    No, I forgot about that request. You would set the Allow Edits property of the form to No to prevent editing of existing records. You can still edit the data in a *new* record, it will be locked as soon as you save it by moving to another record or by explicitly saving it.

Posting Permissions

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