Results 1 to 5 of 5
  1. #1
    mhs5466 is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    6

    Type mismatch error on opening from with multiple criteria

    Hi every one!

    I have a main form where I want to open an other form on some given filter cirteria but it gives me "Type mismatch" error, after struggling for two days i am asking community for help, It will be greatly appreciated if some body can solve this.

    The code is here below:

    stLinkCriteria = stLinkCriteria = "[PCPNo]=" & "'" & Me![DN1] & "'" And "[SupplierCode]=" & "'" & Me![SelectedSup] & "'"

    DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria

    Note : Both the criteria fields are text

    Thanking in anticipation


    Sunny

  2. #2
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    Spot the deliberate mistake

    stLinkCriteria = stLinkCriteria = "[PCPNo]=" & "'" & Me![DN1] & "'" And "[SupplierCode]=" & "'" & Me![SelectedSup] & "'"
    Answer

    Code:
    stLinkCriteria = stLinkCriteria & "[PCPNo]=" & "'" & Me![DN1] & "'" And "[SupplierCode]=" & "'" & Me![SelectedSup] & "'"

    Or
    Code:
    stLinkCriteria = stLinkCriteria & "[PCPNo]='" &  Me![DN1] & "' And [SupplierCode]='" &  Me![SelectedSup] & "'"
    David

  3. #3
    mhs5466 is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    6
    Sorry by mistake I type "StLinkCriteria=" twice, thats why your reply is confusing me, the actual code goes here...I am sorry again David

    stLinkCriteria = "[PCPNo]=" & "'" & Me![DN1] & "'" And "[SupplierCode]=" & "'" & Me![SelectedSup] & "'"

    DoCmd.OpenForm stDocName, acNormal, , stLinkCriteria

  4. #4
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    If you do a Debug.print stLinkCriteria above the DoCmd. What does it display in the immediate window?

    David

  5. #5
    mhs5466 is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    6

    Your second code worked...!

    Or
    Code:
    stLinkCriteria = "[PCPNo]='" &  Me![DN1] & "' And [SupplierCode]='" &  Me![SelectedSup] & "'"
    David[/QUOTE]

    Thanx a billion David, your this code worked nicely...
    Sunny

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

Similar Threads

  1. Type Mismatch - HELP!
    By jgelpi in forum Programming
    Replies: 3
    Last Post: 07-17-2009, 03:53 PM
  2. Replies: 4
    Last Post: 05-16-2009, 09:17 PM
  3. Replies: 2
    Last Post: 03-23-2009, 05:39 AM
  4. Error opening DLL
    By rhodesengr in forum Access
    Replies: 0
    Last Post: 10-29-2007, 11:47 AM
  5. "Type Mismatch" Error
    By elmousa68 in forum Access
    Replies: 2
    Last Post: 12-05-2006, 08:28 AM

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