Command Button to add value

CanadianROCK

Registered User.
Local time
Yesterday, 17:59
Joined
Aug 22, 2015
Messages
13
I have a form that users input data ..
Example

"NAME" Crayons Pack of 20 with input field user would enter how many units they sell example 1 or 2 or 3

What i would like is

Instead of selecting input field and typing in 1 or 2 or 3 Units sold

A command button that each time you mouse down on it . It would add 1 to input field Mouse down again .. Add 1 more Etc Etc But show input amount in input field

Hope this makes sense ..

T.I.A.
 
Me.TextboxName = Me.TextboxName + 1
 
Hrmm I tried something close to that a few days ago .. thought I had it all figured out .. was about to promote myself 2nd level FAIR Access user ..

Not so sure now ..

Want to click on What was a textbox I will make it a button Want to click button have input of +1 for each click entered in Control source ..

TIA
 
What I posted was VBA code that will add 1 to a textbox every time it's executed.
 
Ok .. Sorry but I get Compile error In source properties Under Mouse down I placed


Private Sub Special_Order_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Special Order = Me.Special Order + 1
End Sub

Special Order being control source .. I get Compile error when debugging ..

TIA
 
The inadvisable space would require the name be bracketed.
 
I read up on brackets .. good read .. head hit the keyboard a few times .. But part of the curve .. I read up on brackets and closed brackets Also read up on spaces .. SO I tried Underscore for the spaces in Special_Order didn't get any errors when debug .. But didn't work either SO on I read About Brackets .. Bracketed Special Order Syntax error .. Bracketed whole statement

Well I'm sure you know how that turned out .. SO more reading it is .. but for now ,, Since it was just something I wanted to try .. But obviously there more to learn .. and i'm fine with that .. Love this stuff .. Watch for my next post .. far simpler I think ..

But thank you so much for getting me this far ..

Thank you so much
 
No problem. I'd have expected:

Me.[Special Order] = Me.[Special Order] + 1

But of course not having spaces or symbols is preferred (underscore is fine).
 
Thank You so very much .. works as I wanted it to

But have a small glitch I have a total of 16 fields I use to enter data

However very sporadically it will show the entered data in this case "1" then when I click in another field it won't show the value .. unless I either click again to add 1 more .. OR click in another feild .. but sporadically one time field 1 will show the value in real time .. then next time it won't etc etc .. I read up .. I changed the default update interval from 60 to 0 didn't reall seem to make a difference

Any help would be greatly appreciated Even if thats lead me in the right direction ..

TIA
 
Hmm. Are you referring to the textbox or the field name in your code? I'd use the textbox. Can you post the db here? I can't think of why values would not show sometimes.
 
The main form I use is Customer Information Center It should auto open ..

the testing card number I use is 123456 but you can use any from table Customers ..

I know it's a little or alot rough around the edges But i was and still am on the learning curve

Thank You In Advance "TIA"

EDIT I had to delete ALOT to get under the 2mb But for the most part .. should still work
 

Attachments

Last edited:
Sorry, didn't notice you'd added the file later. For starters, your database is not normalized, the sales table in particular:

http://www.r937.com/Relational.html

Also, it's not a good idea to have spaces or symbols (like the ') in object names.

To the problem at hand, did you try with referring to the textbox rather than the field? For example, the name of the Captain Black textbox is CBPack, but the field is CB Pack. I'd refer to CBPack rather than CB Pack in the code.
 
By the way, in my testing I ran into a Null which made the code not work. This gets around that:

Me.CBPack = Nz(Me.CBPack, 0) + 1
 
I'm on the road so I can't Rember the error but I get an error

Thank you so much all the help Paul

Regards
Russell
 
Happy to help! I can't remember the solution, but there is a solution. :p
 
Hi Paul .. Thank you for the Hint towards the solution .. itried the "[]" Brackets .. I either get end of statement ot syntax error .

Im reading OH and am going to to remove all the " ' " in my 20's 25's ETC ..

TIA
Russell
 
Seems no matter what i do I error out .. even using "()" brackets I get erros depending of course where I use the brackets or closed brackets .. just get various errors

Did manage to change out the 20, 25 etc .. manually went threw DB and changed dependencies
 
Not sure what to say. The code I posted worked for me. Can you post a sample that errors?
 
My bad paul .. I started with a fresh copy of DB ...And it all works except the ones with " ' " comma in them like 20's and 25's now I assume I have to brackets those ? I tried changing 20'2 ext in table and have the changes populate threw out DB Best i came up with a lookup for dependencies .. but that misses modules I think ...

It's coming together .. Once again .. Thank You Paul

regards
Russell
 

Users who are viewing this thread

Back
Top Bottom