Results 1 to 11 of 11
  1. #1
    TEN is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    7

    3464 error received

    Hi guys
    I am recieving the following error: 3464 Error found data type mismatach in criteria expression
    Code:
    Function Update_table()
       Dim db1 As Database
       Dim rs1 As Recordset
       Dim rs2 As Recordset
       Dim sDsloan As String
       On Error GoTo Err_Rtn
       Set db1 = DBEngine(0)(0)
       Set rs1 = db1.OpenRecordset("_Tbl_Fees_Cncls_06222009", dbOpenDynaset)
       Set rs2 = db1.OpenRecordset("TRN", dbOpenDynaset)
       Do While Not rs1.EOF
          'sDsloan = rs1!dsloan
          rs1.FindFirst "DSLOAN = " & rs2!Trloan
          If rs1.NoMatch Then
             MsgBox "No detail recs present "
             GoTo GoRnd
          End If
          rs1.Edit
          rs1!TRCODE = rs2!TRCODE
          rs1!TRDATE = rs2!TRDATE
          rs1.Update
    GoRnd:
          If Not rs1.EOF Then
             rs1.MoveNext
          End If
       Loop
       rs1.Close
       rs2.Close
       Exit Function
    Err_Rtn:
       MsgBox "Err found " & Err.Description & " " & Err.Number
    End Function
    thank you,


    Trudye

  2. #2
    TEN is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    7
    Sorry about that I forgot to include:

    The line of code that is causing the problem is
    rs1.FindFirst "DSLOAN = " & rs2!Trloan
    Both fields are 20 byte text fields, that's why this is so puzzling

  3. #3
    jya is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2007
    Location
    Chicagoland
    Posts
    109

    How about...

    putting quotes around the field. I put spaces in to make it easier to see.

    rs1.FindFirst "dsloan = ' " & rs2!Trloan & " ' "

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Start by specifying the library in your Dim statements:
    Dim db1 As DAO.Database
    Dim rs1 As DAO.Recordset
    Dim rs2 As DAO.Recordset

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Without knowing more about your tables it seems like your code is not going to function as you expect and structured code can eliminate the GoTo.

  6. #6
    TEN is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    7
    Thank you all for your feedback,

    Trudye

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is your problem resolved?

  8. #8
    TEN is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    7
    Actually I rewrote it in T-SQL, but I really do appreciate everyone taking the time to respond.

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That sounds like a solution to me. Is there any way to share your solution with this forum in the event someone else has a similar situation?

  10. #10
    TEN is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2009
    Posts
    7
    Not a problem, I love to share.
    UPDATE dbo. Tbl_Fees_Cncls_06222009
    SET TRCODE_2 = TRAN.TRCODE,
    TRDATE_2 = TRAN.TRDATE
    From dbo.Tbl_Fees_Cncls_06222009inner join TRAN
    ON DSLOAN = TRLOAN
    Thanx again

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for sharing. I marked this thread as Solved.

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

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