Results 1 to 5 of 5
  1. #1
    squashedmos is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    3

    Buttons to add, substract and reset values

    Greetings. I'm rather new to access and VB so I'm having a bit of trouble here. I need a button that on click permanently adds +1 to a specific number field on the form's table, one that permanently subtracts 1 to that same number field and one that resets the value of ALL number fields from all registries on the table to 0. What code do I need to implement to get those things done? I've been searching and read several similar situations but what options I've tried have not worked at all :S.

    My number fields are Prof 1, Prof 2, Prof 3.



    Thanx in advance.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    Don't understand.

    What are registries?

    You want a table full of zeros? The same table just added and subtracted to?

    Could you explain more what you are doing and why?

    Do you want to provide the project for analysis?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    squashedmos is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    3
    Greetings and thank you for your answer.

    My structure is as follows

    Customer Prof1 Prof2 Prof3
    Stud1_____1________5
    Stud2_________2___6
    .
    .
    .

    The purpose of this DB is to keep record of how many classes each professor has given so here Prof1 gave 3 in all. By registry I mean each student, so the registry for Stud2 has clases on both Prof1 and Prof2. What I need are two buttons that I can put in the form next to Prof1, Prof2 Prof3, one to +1 and the other to -1 the number of clases said professor has given, say, Stud1 so that each time Stud1 shows up I just +1 the corresponding professor.

    As to the button to reset all Prof1-2-3 values to 0 I solved it with an update query, since this option will be used once a month to whipe the record clean, it's not such big a deal clicking on the "yes I am sure I want to erase" thing, but it would be maddening to have to go over that every single time I need to +1 a Professor :S. I hope I have made myself clear n_n'

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I use only VBA code. So in button Click event select [Event Procedure]. Double click the ellipses (...) and that will but you in the procedure in the VBA editor. Type code like:

    Me!Prof1 = Me!Prof1 - 1

    Adjust the sample expression for each button you create. The code will act on the record that has focus on the form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    squashedmos is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2012
    Posts
    3
    @_@ Thanks a lot, worked like a charm!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Auto Increment Reset
    By Sibtain in forum Programming
    Replies: 3
    Last Post: 10-25-2012, 01:59 AM
  2. Reset imageBox on a form?
    By bosve73 in forum Forms
    Replies: 0
    Last Post: 08-11-2010, 07:16 AM
  3. Summarize on different columns and substract
    By mauro27 in forum Queries
    Replies: 3
    Last Post: 04-27-2010, 01:46 AM
  4. How to Reset Comboboxes
    By bbarrene in forum Programming
    Replies: 5
    Last Post: 01-23-2010, 11:11 PM
  5. reset primary key
    By emilylu3 in forum Access
    Replies: 1
    Last Post: 12-09-2005, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums