Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Location
    Amarillo, Texas, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Data Type Mismatch in Dlookup (Access 2000)

    I am trying to populate an unbound text box using DLookup in the Form Load Event. I am getting a run time error '3464' "Data type mismatch in the criteria expression" from the following code.

    txtCTU20Key1Value.ControlSource = DLookup("[Value]", "qryCTU20Key1", "[EXP20-CLMNO] =" _
    & [forms]![frmCTU 20 Record]![EXP20-CLMNO])

    The field [EXP20-CLMNO] is defined in the table as text and is included in qryCTU20Key1.
    I am approaching this thru the form load event and a case statement because there could be a different number of queries that will need to be accessed based on a count value from another table. All the queries that will be created will use similar code based on the count value from the other table.
    <img src=/S/confused.gif border=0 alt=confused width=15 height=20> How do I resolve the data type mismatch issue and get the value posted to the text box?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Data Type Mismatch in Dlookup (Access 2000)

    since it's text, try this:

    <pre>txtCTU20Key1Value.ControlSource = DLookup("[Value]", "qryCTU20Key1", _
    "[EXP20-CLMNO] ='" & [forms]![frmCTU 20 Record]![EXP20-CLMNO]) & "'"</pre>

    Charlotte

  3. #3
    New Lounger
    Join Date
    Aug 2001
    Location
    Amarillo, Texas, USA
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Data Type Mismatch in Dlookup (Access 2000)

    I had to modify it to this and the code ran.
    txtCTU20Key1Value.ControlSource = DLookup("[qryCTU20Key1.Value]", "qryCTU20Key1", _
    "[EXP20-CLMNO] =" & "'" & [Forms]![frmCTU20Record]![EXP20-CLMNO] & "'")

    However, on my form I get #Name? as the value in my text box.

    Any suggestions?

Posting Permissions

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