I have tried everyway possible to insert the current date (short form) upon the field being double clicked in my form. Again.. Please Help.. I know this a basic fuction, but try aas I might, I cant get it right.
Place this code in the On Dbl Click event of your txtbox.<br><br>Private Sub txtYourDate_DblClick(Cancel As Integer)<br>Me![txtYourDate] = Date<br>End Sub<br><br>Change "txtYourDate" to the name of your textbox.<br><br>HTH<br>RDH <p>Ricky Hicks<br><a href=mailto: rdhicks@mindspring.com> rdhicks@mindspring.com</a><br><a href= > </a><br>
Hold down the Ctrl key and press the ";" key. This works on any form without writing code. <p>Jim Conrad<br><a href=mailto:jconrad3@visteon.com>jconrad3@visteon.com</a><br><a href= > </a><br>
Create a new entry filed.<br><br>I usually place the following line in the default value field:<br><br>=date()<br><br>Other useful time/date commands are:<br><br>time()<br>now()<br><br>and format$("dd mmmm dddd", YourDateField)<br> format$("hh:nn", YourTimeField).<br><br>I have found these command extremely useful in forms and reports.<br><br>I hope these are useful<br><br>Shane Brennan<br>
Ok,<br><br>I din't mean to be thick, but I've tried all of these. I suppose I wasnt being clear (I apologize).<br>What I need to do is allow users that open up my form to double clicck on a field and Access will automatically insert the current date. <br><br>I thought the =date() was the best to put in the OnDblClick macro, but it didnt work.<br><br>Thanks a Million for your patience with me!!
The OnDblClick is not a <b>macro</b>, it's an <b>event</b>. <br>1. Go into design mode of your form.<br>2. Right click on the control you want to add this functionality to. <br>3. This will bring up the properties box. <br>4. Click on the Event tab, then the "..." button next to On Dbl Click. <br>5. Select Code Builder and click on OK. <br>6. A code window will open. <br>7. Insert Ricky's code between the other two lines of code that appear, like this:<br><br>Private Sub cmdOpenClosetForm_DblClick(Cancel As Integer)<br>Me![txtYourDate] = Date<br>End Sub<br><br>8. substitute the name of your control for what's inside the brackets -> txtYourDate<br>9. if you don't know the name of the control, click on the "Other" tab of your properties form and look under "Name".<br>10. Good luck <br>
THANK YOU ALL!<br><br>I finally Got it working!!!<br><br>Is there a code that will cause any field in the form that is double clicked to input the current date (so the code doesn't call out one particular field)? <br><br>
Create a procedure in the form:<br><br>Sub InsertDate()<br><br> Screen.ActiveControl=Date<br><br>End Sub<br><br>Then for the Double-click event of all the controls just type Insertdate as the only line in the procedure. Format the textboxes to display the date as desired.<br><br>
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.