Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2012
    Posts
    17

    Unanswered: Open for using 2 criteria

    Hi,

    I have a form that is used to open another form using command button. I want the 2nd form to filer out records based on criteria from the fist form. I have looked over postings but cannot seem to get it to work.
    Here is code I am using, criteria being used is persons name and month

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "tbl Feedback"

    stLinkCriteria = "[Month]=" & "#" & Me![Month] & "#" And "[Name]=" & "'" & Me![Name] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria


    Thanks

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    This seems to be incorrect:
    Code:
    stLinkCriteria = "[Month]=" & "#" & Me![Month] & "#" And "[Name]=" & "'" & Me![Name] & "'"
    You only use the "#" (hash or number sign or pound sign, depending on where you live, see: Number sign - Wikipedia, the free encyclopedia) with Date/Time data type values and I suppose that Me![Month] returns an Integer, not a full date.
    Have a nice day!

Posting Permissions

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