Solved

Need help with importing Date() using parameterized query...

Posted on 2009-07-15
4
239 Views
Last Modified: 2013-11-27
Hi,

I'm using a parameterized query to import a record from my MySQL Database into Access.  I want the date to be formatted as, "mm/dd/yy", but I'm not sure of the Constant to use in my .CreateParameter statement.  I tried this:

.Parameters.Append .CreateParameter(, adDBDate, adParamInput, , Format(Date, "mm/dd/yy"))

but that doesn't work since the format for adDBDate is "yyyy/mm/dd".

How can i do it?  It is important that I store the date in the format I specified.

Thanks!
0
Comment
Question by:MitchellVII
  • 2
  • 2
4 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 24861727
DateTime columns are not stored in a format.  What matters is that it correctly knows the correct date and time value so that when retrieved it displays correctly in your application formatted as "mm/dd/yy".
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 24861733
So this should be fine:
.Parameters.Append .CreateParameter("{paramName}", adDBDate, adParamInput, , Format(Date, "yyyy/mm/dd"))
0
 
LVL 5

Author Comment

by:MitchellVII
ID: 24861849
mw,

Yes, I would think so too, but its throwing me a "Type Mismatch" error.
0
 
LVL 5

Author Closing Comment

by:MitchellVII
ID: 31603850
Oops! (smacks head!).

It works, I just had two lines transposed.  Thanks!
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HasData 9 35
Access query with left expression 5 29
Keeping a combo box up to date for other users 5 22
ms access 2013, running .mdb 2 29
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now