Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    karanvemuri is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    56

    Search issue

    HI guys,



    I have let access chose my primary key for my db, however When i search a record using the date field on the original form, Access creates a new record in the DB ? can this be rectified?

  2. #2
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    How are you doing the search?

  3. #3
    karanvemuri is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    56
    have created a 2ndform to display the search results with the Datefield as the parameter

  4. #4
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    I think the search may be returning no match. Check for this condition before displaying the 2nd form. Also verify that you are comparing similar date formats.

  5. #5
    karanvemuri is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    56
    the search is returning match,but access is allocating a new ID and creatin a record for the searched criteria

  6. #6
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    Please post the code that does the search, and opens the 2nd form.

  7. #7
    karanvemuri is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    56
    Dim Yesterday As Date
    Yesterday = Date - 1

    DoCmd.OpenForm "DetailForm", , , "Date = #" & Yesterday & "#"

  8. #8
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    "Date" is an Access internal function that returns the current date. It is likely that the criteria you are specifying (Where Date (current date) = Yesterday) will always return False. You should not name your table fields or form controls with this name. Try renaming your "Date" field/control to "DetailDate". Then change the OpenForm to

    DoCmd.OpenForm "DetailForm", , , "DetailDate = #" & Yesterday & "#"

  9. #9
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    One more thing to check is your DetailForm DataEntry property. It should be set to "No".

  10. #10
    karanvemuri is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    56
    i renamed the Date field to Detail date..the search is returning match,but still access is allocating a new ID and creatin a record for the searched criteria....

  11. #11
    hitesh_asrani_j is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    75
    Even I am waiting for a reply on this issue....
    Whenever I search with a field, get a result in a new form which is correct... but when i have to create a new record i click on the "new record" button and even the search criteria is saved in the DB :S REally want to clear this off as it is creating undesired space in the DB

  12. #12
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    How can you tell that the search is returning a match?

  13. #13
    karanvemuri is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    56
    I can find the search results in the subform which i have created

  14. #14
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    What is the search criteria or filter that you've specified to get the desired results in your subform?

  15. #15
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    Oh, this just occurred to me... Try this:

    DoCmd.OpenForm "DetailForm", , , "format(DetailDate,'yyyymmdd') = format(#" & Yesterday & "#,'yyyymmdd')"

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. VBA Issue
    By MikeDBMan in forum Access
    Replies: 9
    Last Post: 08-02-2011, 03:59 PM
  2. Date/Time Search Midnight Issue
    By Coffee in forum Queries
    Replies: 5
    Last Post: 07-26-2011, 01:54 AM
  3. Issue with Do
    By Petefured in forum Programming
    Replies: 1
    Last Post: 05-25-2011, 09:27 AM
  4. Replies: 4
    Last Post: 03-17-2011, 06:17 AM
  5. Replies: 2
    Last Post: 08-31-2010, 08:57 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