Results 1 to 3 of 3
  1. #1
    Join Date
    May 2009
    Posts
    11

    Question Unanswered: Run-Time Error '3464' Data Type Mismatch In Criteria Expression

    Hi all
    Can anyone help with this error message that keeps occuring. 'Run-Time error 3464 Data Type Mismatch In Criteria Expression.' It happens in my code below in the line highlighted in red. Thanks in advance

    Option Compare Database
    Option Explicit

    Private Sub Custodian_History_Form_Enter()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim rs2 As DAO.Recordset
    Dim strQuery1 As String
    Dim strQuery2 As String

    Dim nod As Object
    Dim strNode1Text As String
    Dim strNode2Text As String
    Dim strVisibleText As String

    Dim strMessage As String
    Dim intVBMsg As Integer

    Set db = CurrentDb()
    strQuery1 = "select DISTINCT AssetNumber from [Asset Master]"
    With Me![Custodian History Form]
    Set rs = db.OpenRecordset(strQuery1) ', dbOpenForwardOnly)
    Do Until rs.EOF
    Debug.Print rs![AssetNumber]
    strNode1Text = StrConv("Level1" & rs![AssetNumber], _
    vbLowerCase)
    Set nod = .Nodes.Add(Key:=strNode1Text, Text:=rs![AssetNumber])
    nod.Expanded = False

    strQuery2 = "select DISTINCT AssetNumber, [Asset Name] from [Asset Master] where [AssetNumber] = '" & nod.Text & "'"
    Set rs2 = db.OpenRecordset(strQuery2)
    Do Until rs2.EOF
    strNode2Text = StrConv("Level2" & rs2![Changes In Asset], vbLowerCase)
    strVisibleText = rs2!AssetNumber
    'if modelname is null, will have problem
    If IsNull(rs2!AssetNumber) Then
    MsgBox "number is null"
    strVisibleText = "No Name"
    End If
    Set nod = .Nodes.Add(relative:=strNode1Text, relationship:=tvwChild, _
    Key:=strNode2Text, Text:=strVisibleText)
    rs2.MoveNext
    Loop
    rs2.Close
    rs.MoveNext
    Loop
    rs.Close
    End With

    End Sub
    Last edited by nick.tait; 05-28-09 at 01:57.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6

  3. #3
    Join Date
    May 2009
    Posts
    11
    Thanx Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •