Results 1 to 4 of 4
  1. #1
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202

    open new form with date from unbound field in anthoer form


    I am attempting to enter a date(dtDate) on frmHistoryDate and open another form with all entries and data on antoher form (frmLogActivityReview). I used the vba code:
    DoCmd.OpenForm "frmLogActivityReview", acNormal, , "[DateCase] ='" & Me.dtDate

    It opens the form, but does not show data (form is blank). I know it is something simple I am missing. Can anyone help?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    your filter is broken...it only has 1 quote. Fix:
    DoCmd.OpenForm "frmLogActivityReview", acNormal, , "[DateCase] ='" & Me.dtDate & "'"

  3. #3
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    When I run that code, I get a run-time error 3464 for data type mismatch. I checked both fields and they are both short date. any ideas?

  4. #4
    mlrucci is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2018
    Posts
    202
    I found the problem, first, need to change the single quote (') in the command to #. I also removed the brakets ([]).
    OLD:
    DoCmd.OpenForm "frmLogActivityReview", acNormal, , "[DateCase] ='" & Me.dtDate & "'"
    NEW: DoCmd.OpenForm "frmLogActivityReview", , , "DateCase = #" & Me.dtDate & "#"

    Thank you for your help!


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

Similar Threads

  1. Replies: 22
    Last Post: 07-24-2019, 05:35 AM
  2. Replies: 2
    Last Post: 06-22-2019, 02:26 PM
  3. Replies: 5
    Last Post: 06-23-2014, 03:32 PM
  4. Replies: 3
    Last Post: 05-02-2013, 01:59 PM
  5. Replies: 4
    Last Post: 04-22-2011, 03:08 PM

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