Solved

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

Posted on 2009-07-15
4
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 60

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 60

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

Webinar: Security & Encryption in the MySQL world

Join Percona’s Solutions Engineer, Dimitri Vanoverbeke as he presents “Security and Encryption in the MySQL world” on Thursday, July 6, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

690 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