Results 1 to 8 of 8
  1. #1
    seb is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    73

    How to display a Message


    Hello
    I have a form based in a parameter Query
    Between "*" & [Forms].[FSearc].[txtStart] Y [Forms].[FSearch].[txtEnd] & "*"

    If the search does not retrieve records, how can I do to display in the Form this Message: "No records in database, Try again"

    Many thanks in advance

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    Maybe:
    If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox "No Records Found", vbExclamation
    End If
    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.

  3. #3
    seb is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    73

    Question

    Quote Originally Posted by June7 View Post
    Maybe:
    If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox "No Records Found", vbExclamation
    End If
    Many Thanks
    I tested the code in the command search button but an error 2467 is displayed and colouring in yellow If Me.RecordsetClone.RecordCount = 0 Then

    Where do I can mark the thread as Solved?

    Private Sub cmdSearch_Click()
    DoCmd.OpenForm "FBuscar", acViewNormal
    DoCmd.Close acForm, Me.Name
    If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox "No Records Found", vbExclamation
    End If
    End Sub

    Thanks againg

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    So the code is working? I had my fingers crossed when I posted that code - found on net but not tested.

    On the menu bar of first post, under Thread Tools can choose Solved.
    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
    seb is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    73
    June

    The code is no working yet

    I'm sorry my message is confused.English is not my mother tongue

    I tested the code in the command search button. However, when I click the button an error 2467 is displayed and colouring in yellow the piece of code you send me:
    If Me.RecordsetClone.RecordCount = 0 Then

    The code I have for the search button works fine when it finds records:
    Private Sub cmdSearch_Click()
    DoCmd.OpenForm "FSearch", acViewNormal
    DoCmd.Close acForm, Me.Name
    End Sub

    If I add your code
    Private Sub cmdSearch_Click()
    DoCmd.OpenForm "FBuscar", acViewNormal
    DoCmd.Close acForm, Me.Name
    'I add your code here
    If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox "No Records Found", vbExclamation
    End If
    End Sub

    My problem is that after clicking the button the error 2467 message is displayed.
    Seems to be is my error. Where I must write your code?

    Thanks again

  6. #6
    blueraincoat is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Shanghai,CHN
    Posts
    99
    I think you should add the code right behind the query you mentioned, maybe just before closing the form

    By the way why there's not condition in your open form syntax?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    I was able to get the RecordsetClone code to work. Check this article http://allenbrowne.com/casu-20.html

    Instead of button event, use the form Open event of the form you want to open.
    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.

  8. #8
    seb is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    73

    Smile

    Quote Originally Posted by June7 View Post
    I was able to get the RecordsetClone code to work. Check this article http://allenbrowne.com/casu-20.html

    Instead of button event, use the form Open event of the form you want to open.
    June
    Thank very much. Now is working as I expected

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

Similar Threads

  1. Message Box
    By BorisGomel in forum Programming
    Replies: 6
    Last Post: 04-25-2011, 02:16 PM
  2. Message Box
    By dunnmel4 in forum Programming
    Replies: 9
    Last Post: 04-12-2011, 10:44 PM
  3. Display a message for some time
    By wasim_sono in forum Programming
    Replies: 2
    Last Post: 03-05-2010, 11:11 AM
  4. Report control of a field display/no display
    By systems013 in forum Reports
    Replies: 5
    Last Post: 02-01-2010, 09:44 AM
  5. message box help
    By shaz10010 in forum Forms
    Replies: 1
    Last Post: 04-17-2009, 09:11 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