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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text combo box 1

Status
Not open for further replies.

ncopeland

IS-IT--Management
Mar 12, 2002
88
GB
Hi

I have text combo box that I control using the following. In the control source I have =Date().

Because the user does not have to enter on the box this field appears not be updated. When I try to write this value to another field I get 30/12/1899. Is there a function to update this text box so that the correct value is retrieved.

KR

NC.
 
Hi Skip

That worked fine. One small problem the date inserted is stored as mm/dd/yyyy.

I tried the format command

strSql = strSql & "VALUES (" & theYear & ", " & thePeriod & ", #" & Format(theCostingDate, "dd/mm/yyyy") & "#)"

but that didn't seem to work either.

KR

NC.
 



A DATE is a DATE.

DATES are just NUMBERS, like today is 39182. As you discovered, ZERO is 1899/12/31.

That DATE VALUE can be FORMATTED in any number of ways when you REPORT or QUERY using the FORMAT function (which, BTW, returns TEXT, not a DATE).

Don't loose any sleep over what you see in the table.

Skip,

[glasses] [red][/red]
[tongue]
 
I don't know if this will help but i hade the same issue, so i created a macro called MacroSetDate and the macro ran the following procedure:
Code:
Action      SetValue
Item:       [Forms]![name of the form]![name of the field]
Expression: Date()

I needed to make sure the record was saved before updating the date, and i creating the following code in the button
Code:
Private Sub ButtonUpdate_Click()
DoCmd.RunMacro "macrosetdate"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End Sub
This is simple code but it may work for what you need and it can be added to an existing control button

-Kerry

Those that know, do. Those that understand, teach. -Aristotle

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top