Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Current Date in Combo Box / Drop Down 1

Status
Not open for further replies.

grippy

Programmer
Dec 2, 2004
161
US
Hello i am making a form where employees will process orders. When an order is shipped out they currently enter in the date it was shipped out. Is there anyway I can make a drop down with 1 row that always has the current date so that it is much easier for the user to click the date rather than typing it in? Thanks
 
Have you tried Date()?

-------------------------
Just call me Captain Awesome.
 
Ok i use the wizard to create a combo box and select the "I will type in alues I want option" then i put the Date() in as the first row but it just shows that as text in the form on the drop dwon. Where should I be putting this value?
 
grippy . . . . .

Why not set the [blue]DefaultValue[/blue] property of the textbox to the Current Date ([purple]Now()[/purple]).?

That way no one has to click anything!

Calvin.gif
See Ya! . . . . . .
 
because when a order is created it isnt automatically shipped, processed, faxed... So if i set the DB to auto generate the date then it would think the order is completed all on the same date when in reality it was never even processed.
 
and also if someone processed an order but didnt have time to enter it into the DB i still want the option to type in a previous date manually.
 
Understood grippy . . . . .

How about this:
[ol][li]In the [blue]Status Bar Text[/blue] & [blue]ControlTip Text[/blue] properties, enter [purple]Double-Click to enter Current Date![/purple]. This will prompt in the [blue]Status Bar[/blue] when the user puts the cursor in the [purple]Date Control[/purple] as well as the pop-up tool tip, or whenever the user hovers the mouse over the control the pop-up will appear.[/li]
[li]In the [blue]DBL Click Event[/blue] of the [blue]Date Control[/blue], copy/paste the following ([blue]You![/blue] substitute proper names in [purple]purple[/purple]):
Code:
[blue]   Me![purple][b]YourDateControlName[/b][/purple] = Int(Now())[/blue]
[/li][/ol]
[purple]Thats it . . . give it a whirl & let me know . . .[/purple]

Calvin.gif
See Ya! . . . . . .
 
ok I got the Status Bar Text and Control Tip Text in and working find but when I double click the text box where it inputs the date this is what i get

MS Access cant find the macro 'Me!orderDate = Int(Now()).'

I have this in my On Dbl Click event for the text box orderDate

Me!orderDate = Int(Now())

My text box control source and name are both orderDate

Let me know what Im doing wrong because your soultion seems even faster than my idea and i like it. Thanks a bunch

 
grippy . . . . .

You probably have the code on the event line (not in the actual event itself).
[ol][li]Put the cursor on the event line and select [blue][Event Procedure][/blue] from the dropdown list.[/li]
[li]Click the three elipses
Elipses.BMP
just to the right. This takes you to the [blue]VBE[/blue] editor where the cursor will be inside the event. The event should look like the following when your done:
Code:
[blue]Private Sub OrderDate_DblClick(Cancel As Integer)
   Me!OrderDate = Int(Now())
End Sub[/blue]
[/li]
[li]Press [purple]Alt + Q[/purple] to return to form design view.[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
Awesome worked like a charm. You saved me a bunch of time thank you so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top