DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: VB6 , ACCESS 2003 Update numeric DataType with Text dataType

  1. #1
    Join Date
    Jan 2005
    Location
    New Zealand
    Posts
    319

    VB6 , ACCESS 2003 Update numeric DataType with Text dataType

    Hi Friends,

    I encounter problem using ACCESS 2003 Query to update a columnname = PartyYear with DataType = Numeric

    using data from another columnname = InputDate with DataType = TEXT.


    This is the SQL String created via ACCESS SQL View:
    UPDATE TblOrderDetails SET TblOrderDetails.PartyYear = Year("InputDate");

    The sql string generated this error message:Data Type Mismatch in criteria Expression.

    Please help me. I need your help.
    Cheers,
    Lennie

  2. #2
    Join Date
    Jun 2009
    Posts
    135
    The year function is expecting a date value and if inputdate is a string variable and is already a formatted string i.e. "6/4/10" or "6/4/2010" or in whatever format, what you are actually passing to the year function is "inputdate". So to fix...

    strSQL = "UPDATE tblOrderDetails SET tblOrderDetails.PartyYear = " & Year(InputDate)



    Good Luck

  3. #3
    Join Date
    Jan 2005
    Location
    New Zealand
    Posts
    319
    Hi Vb5prgrmr,

    Thrught trial and error I have fixed the error of SQL String created ACCESS QUERY.
    I have removed the Double Quote from this SQL STRING

    UPDATE TblOrderDetails SET TblOrderDetails.PartyYear = Year("InputDate");

    to this version
    UPDATE TblOrderDetails SET TblOrderDetails.PartyYear = Year([InputDate]);
    Cheers,
    Lennie

Similar Threads

  1. Re: Should I convert Memo to TEXT?
    By David Satz in forum Database
    Replies: 2
    Last Post: 05-31-2002, 01:01 PM
  2. Access & SQL Server
    By David Jones in forum Database
    Replies: 0
    Last Post: 08-31-2001, 12:22 PM
  3. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  4. Access 2000 automation from VB6
    By Mak Foka in forum authorevents.kurata
    Replies: 3
    Last Post: 04-18-2000, 08:21 PM
  5. Replies: 0
    Last Post: 04-17-2000, 01:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center