Results 1 to 3 of 3
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    query with no results

    Hi



    created a soundex query as below

    Code:
    SELECT tbl_Baptism.BaptismID, tbl_Place.Place, tbl_Baptism.FicheNo, tbl_Baptism.BirthDate, tbl_Baptism.DateOfBaptism, tbl_Baptism.YearOfBaptism, tbl_Baptism.ChildsName, tbl_Baptism.Surname, tbl_Baptism.Sex, tbl_Baptism.Parents, tbl_Baptism.Abode, tbl_Baptism.Occupation, tbl_Baptism.Church, tbl_Baptism.RefNo, tbl_Baptism.PageNo, tbl_Baptism.EntryNo, tbl_Baptism.Minister, Soundex([ChildsName]) AS Expr1, tbl_Baptism.FullDateOfBaptism
    FROM tbl_Place INNER JOIN tbl_Baptism ON tbl_Place.ID = tbl_Baptism.[fk_PlaceId]
    WHERE (((Soundex([ChildsName]))=Soundex([Enter a Name])))
    ORDER BY tbl_Baptism.FullDateOfBaptism;
    Using the soundex code from http://allenbrowne.com/vba-Soundex.html

    It works well except that when I run a form based on the above query if the Soundex does not find any match the results form is not displayed in a nice way. Is there a way to add a criteria so that if no matches are found another form opens ?

    thanks]

    Ian
    Attached Thumbnails Attached Thumbnails screendump.jpg  

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Code:
    If dcount("*","qsQuery") =0 then
        MsgBox "No results"
    else
        Docmd.openquery "qsQuery"
    end if

  3. #3
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    thanks for the code and I sort of understand it ;-)

    But how would i use it?

    At the moment I have a button calling a form based on the query above.

    My forays into the VB side of access are few

    thanks

    Ian

    Quote Originally Posted by ranman256 View Post
    Code:
    If dcount("*","qsQuery") =0 then
        MsgBox "No results"
    else
        Docmd.openquery "qsQuery"
    end if

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

Similar Threads

  1. Replies: 3
    Last Post: 02-22-2016, 03:38 PM
  2. Replies: 7
    Last Post: 05-27-2015, 12:45 PM
  3. Replies: 5
    Last Post: 05-21-2013, 02:21 PM
  4. Replies: 3
    Last Post: 05-02-2013, 10:36 AM
  5. Replies: 6
    Last Post: 05-14-2012, 07:24 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