Is there a formula or code to put in the date and time in a text box so it updates automatically whenever a button is clicked?
Is there a formula or code to put in the date and time in a text box so it updates automatically whenever a button is clicked?
actually I only need the date, no time...how do I do that?
Ah, a moving target.
Me.TextboxName = Date()
Thank you!
I have one more scenario...I have 3 buttons right now one that when you click it a input message appears and asks for a value which it then puts that value into a textbox | Me![Total] = Val(InputBox("Please enter a value:")) |, thats the code. Next I have another button that when you press it, it increments by 1 but what I want it to do instead is when you click that button another input message appears asking How much would you like to add to the total inventory and then it adds the number you put in onto what is already there in the textbox...any idea?
Help would be greatly appreciated
Along the lines of
Me.Textbox = Me.Textbox + InputBox(...)
I'd probably add some validation of the input first.
How do I get an Input message to show saying "How much Inventory Received" which then shows that number alone in a separate textbox as well as that number being added to the "total' textbox?
The code you gave me is adding a 5 at the end of the actual total, how do I get it to do addition to the total, if i enter 5 in the Plus button id like it to go from 500 to 505, as well as just showing a 5 right next to the +1 button.
Here is a picture
If it's concatenating instead of adding, your numbers are being seen as text for any number of reasons (data type, functions, etc). If you can't fix that you can work around it:
Me.Textbox = CLng(Me.Textbox) + CLng(InputBox(...))
Or one of the other conversion functions, as appropriate to your situation.
I put in what I needed to accordingly for it to work in my form but it is giving me an error.. it seemed like it worked at first but then kicked it to an error. At first when I put a 5 in the input box it did add the 5 to 500 making it 505, but it did not show the 5 alone in the textbox next to the + button.
What's the error? What's your actual code?
Code is working the only part that isn't working now is when I hit cancel on the input box 'Run-error '13': Type Mismatch pops up asking me to "end" or "debug" how do i get that to stop
Like I said earlier, I'd validate the input first:
Code:Dim varInput as Variant varInput = InputBox(...) If IsNumeric(varInput) Then 'Do your thing Else Msgbox "Input must be a number" End If