Results 1 to 2 of 2
  1. #1
    JustLearning is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    26

    Error 3464 - Data type mismatch

    I'm getting a data type mismatch error, but I can't seem to fix it



    Code:
    Dim s As Strings = InputBox("What is the Work Order number?", "Work Orders")
    
    
    Dim qry As QueryDef
    Dim strSQL As String
    
    
    strSQL = "SELECT * FROM [Master Table] WHERE [Work Order #] = " & s
    
    
    If QueryExists("QRY_MYQUERY") = True Then
    CurrentDb.QueryDefs.Delete "QRY_MYQUERY"
    Set qry = CurrentDb.CreateQueryDef("QRY_MYQUERY", strSQL)
    
    
    Else
    Set qry = CurrentDb.CreateQueryDef("QRY_MYQUERY", strSQL)
    
    
    End If
    
    
    Dim x As Integer
    Dim y As Double
    
    
    x = Nz(DMax("[Change Request #]", "QRY_MYQUERY", ""), 0)
    
    
    Me.Text169 = x
    
    
    y = Nz(DLookup("[Total Work Order Amount]", "QRY_MYQUERY", "[Change Request #] = " & x), 0)
    
    
    Me.Text171 = y
    
    
    strSQL = "SELECT * FROM [Master Invoice Table] WHERE [Work Order] = " & s
    
    
    If QueryExists("QRY_MYQUERY") = True Then
    
    
    CurrentDb.QueryDefs.Delete "QRY_MYQUERY"
    Set qry = CurrentDb.CreateQueryDef("QRY_MYQUERY", strSQL)
    
    
    Else
    Set qry = CurrentDb.CreateQueryDef("QRY_MYQUERY", strSQL)
    
    
    End If
    
    
    Dim z As Double
    
    
    z = Nz(DSum("[Invoice Amount]", "QRY_MYQUERY"), 0)
    
    
    Me.Text710 = z
    
    
    Me.Text712 = y - z
    The bolded part gives the error. z = Nz(DSum("[Invoice Amount]", "QRY_MYQUERY"), 0)
    I've tried changing z to integer and currency, but I don't understand why it'd be giving a type mismatch



    EDIT: Rookie mistake, I forgot to change the Work Order in Master Invoice Table to Number instead of Text
    Last edited by JustLearning; 01-17-2013 at 02:02 PM.

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    It's always nice when you can figure it out yourself!

    Thanks for posting the solution and good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Data type mismatch error
    By Tomfernandez1 in forum Programming
    Replies: 5
    Last Post: 10-05-2012, 07:27 AM
  2. Data type mismatch error
    By nigelbloomy in forum Programming
    Replies: 1
    Last Post: 08-01-2012, 09:19 AM
  3. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  4. Data type mismatch error
    By AccessUser123 in forum Queries
    Replies: 1
    Last Post: 05-22-2011, 07:48 PM
  5. Data type mismatch error on all of my queries!
    By MarkGLyons in forum Queries
    Replies: 3
    Last Post: 12-27-2010, 01:27 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
  •  
Other Forums: Microsoft Office Forums