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

Date Format

Status
Not open for further replies.

hedidit

Technical User
Jul 21, 2005
142
0
0
GB
Hi I have a form that a user enters various bits of data onto. , the data is then inserted into a table called 'TblInventory'. The code works fine accept that the field called D8Rec changes format from dd/mm/yyyy to mm/dd/yyyy once it's inserted into the table.

The code I'm using for the insert is:

Code:
CurrentDb.Execute "INSERT INTO TblInventory (Location, IDNum, OrderID, Qty, DateRec) SELECT " & [Forms]![Inventory_Receive]![Location] & " AS Expr7, '" & [Forms]![Inventory_Receive]![D8Rec] & "-1' AS Expr2, " & [Forms]![Inventory_Receive]![idi] & " AS Expr3, 1 AS Expr4, #" & [Forms]![Inventory_Receive]![D8Rec] & "# AS Expr1"

I've tried using:

Code:
format([Forms]![Inventory_Receive]![D8Rec],"dd/mm/yyyy")

To correct the format but it doesn't work.

Can anyone point out what I'm doing wrong?

Thanks
 
Date are *always stored in the same manner regardless of language. What you are describing is simply a display option. Here's a couple of links to help make it clearer.
Storing, Calculating, and Comparing Date/Time Data
Return Dates in US #mm/dd/yyyy# format

HTH RuralGuy (RG for short) acXP winXP Pro
Please respond to this forum so all may benefit
 
Use a non-ambiguous format:
Format(Forms![Inventory_Receive]!D8Rec, "yyyy-mm-dd")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks guys got it working after all using 'format'

Thanks again for the help...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top