I am new to coding with vba in access. I have a checkbox and a textbox. I want to be able to check the checkbox and it sets todays date in the textbox. How can i do this? Thanks in advance.
I am going to have more than one checkbox and textbox that will set the date in the same form. Is there a way to get element id or something. Like javascript you can get the element id for the checkbox so you only have one Private Sub to enter the date for the pertaining textbox. Can we do the same here? If so how. Thanks in advance.
I'm a little confused. Are you talking about using a sub to set the Date for each textbox? What's the point? You'd still have to call the sub from each object, and you're talking about one line of code to simply set the date. If your object is just to have the date set for a textbox, why not use the double-click event for each checkbox? You wouldn't even have to change the code for each field, just use this:
Code:
Private Sub YourTextBoxName_DblClick(Cancel As Integer)
Me.ActiveControl = Date
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.