Results 1 to 5 of 5
  1. #1
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    193

    Open Forms with Condtions


    Hi!
    I am looking for some help. I have two forms. Program Scoring and ProjectScoringReport.
    I'm trying to double click on a date field in Program Scoring, to open ProjectScoringReport, to display a particular record.

    I basically need to conditions set, in order to open the form.

    The two fields from Program Scoring are Program_Name and Launch.

    When I click on the field named Launch, I need ProjectScoringReport to open with it's two fields, Program_Name and End_Date to be equal.

    Basically, it's something like:
    Private Sub Launch_DblClick(Cancel As Integer)
    DoCmd.OpenForm "ProjectScoringReport", _
    WhereCondition:="Program_Name=" & Me.Program_Name And "End Date =" & Me.Launch

    End Sub

    I'm getting runtime error Type Mismatch, when I do this. However, both fields are formatted as text (Program_Name) and End_Date and Launch are both formatted as Date fields...

    Not sure why I'm getting this error, so assumed I jacked something up in my language. Thanks for you assistance, as always!!!!!

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    End Date = #" & me.launch & "#" maybe

  3. #3
    jlgray0127 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Location
    Central Illinois
    Posts
    193
    Same error, but like your reasoning! I thought that would do it, when I read it. Not the case, unfortunately.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Also, if Program_Name is text data type field, need text delimiters. Field names with spaces or special characters/punctuation (underscore is exception) need to be enclosed in []. Need to concatenate the literal " AND " string.

    "Program_Name='" & Me.Program_Name & "' AND [End Date] =#" & Me.Launch & "#"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    oooh good catch june, didn't even think about program name being a text value.

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

Similar Threads

  1. Replies: 3
    Last Post: 11-11-2013, 08:42 PM
  2. Replies: 3
    Last Post: 10-23-2013, 08:11 AM
  3. Replies: 2
    Last Post: 08-07-2013, 07:44 AM
  4. How to open forms
    By raghuprabhu in forum Forms
    Replies: 2
    Last Post: 06-01-2012, 10:42 PM
  5. too many forms open
    By Jaad in forum Database Design
    Replies: 0
    Last Post: 02-22-2010, 08:39 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