By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,462 Members | 2,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,462 IT Pros & Developers. It's quick & easy.

Button to Advance Count in Field

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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
re******@pcdatasheet.com
www.pcdatasheet.com

"Chris L" <da***@lakefield.net> wrote in message
news:7f**************************@posting.google.c om...
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

Nov 12 '05 #2

P: n/a
"Mark" <mm*****@earthlink.net> wrote in message news:<Fl*****************@newsread3.news.atl.earth link.net>...
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.


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
Nov 12 '05 #3

P: n/a
da***@lakefield.net (Chris L) wrote in message news:
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.


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.DoMenuItem 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
acCmdDeleteRecord) 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
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.