Results 1 to 2 of 2
  1. #1
    chessico is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2009
    Posts
    20

    Searchform query opened by macro

    Im using an old version of Access - 2000 and I have a form 'frmDOBsearch'.
    This runs from a macro button on my main menu to open the 'frmDOBsearch'.
    The form uses a query 'qryDOB'. When you run the form a message requests you input the date in the format dd/mm/yyyy. If the date applies to any record it opens the record(s). This works ok, however there is no validation if the date you enter is wrong or there is no person with that date. All I get is the form with no data. Not a huge problem however it would be nice to get a message pop up saying something like 'oops no one with that date of birth!'
    The forms properties 'Filter' has this code " (True) AND (((([S_Members_Table].[DOB])=[Enter the DOB like this dd/mm/yyyy])))"
    The True code doesnt appear to have any effect if its there or not.


    I presume I would have to add some code to one of the forms format properties like after update? Never having used this method not sure how to go about it. Any one any ideas to create validation here

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if instead of using the query criteria to request input you use a form you can solve both of these problems fairly simply. Just create a small form that has an unbound text box, apply a date format to that field. If someone tries to enter a non date value to that field they will get a pop up warning them it's not valid. Secondly in your query instead of having [enter the date mm/dd/yyyy] in your criteria you would have forms!<formname>!<fieldname>. So let's say on your frmDBOSearch you have a field called Inputdate, the criteria in your query would be forms!frmdbosearch!inputdate. This would have to obviously be an unbound text box

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

Similar Threads

  1. Replies: 17
    Last Post: 05-23-2011, 07:27 AM
  2. Auto sort a form when opened?
    By newtoAccess in forum Access
    Replies: 2
    Last Post: 03-19-2011, 03:22 PM
  3. Can not close pop up form after second pop was opened
    By snoopy2003 in forum Programming
    Replies: 2
    Last Post: 03-09-2011, 02:56 AM
  4. Replies: 0
    Last Post: 01-12-2011, 12:43 PM
  5. Check if form is opened by other users
    By ser01 in forum Programming
    Replies: 2
    Last Post: 05-03-2010, 12:07 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