Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Multiple Record Return Alert

Discussion in 'Information Technology' started by ckendricks7@yahoo.com, Jul 28, 2006.

  1. ckendricks7@yahoo.com

    ckendricks7@yahoo.com
    Expand Collapse
    Guest

    I have a form that pulls up individual client records utilizing a
    parameter query as it's Record Source. I want to open a MsgBox if more
    than one client record is returned. I know that I can use the DCount
    function and a field from the returned data (like the primary key) to
    somehow trigger a MsgBox, but I just can't seem to get it to work.
     
  2. Loading...


  3. strive4peace

    strive4peace
    Expand Collapse
    Guest

    how about this:

    '~~~~~~~~~~~~~~~~~~~
    If Me.Recordset.RecordCount > 1 Then
    msgbox Me.Recordset.RecordCount _
    & " records were returned" _
    , , "RecordCount"
    End If
    '~~~~~~~~~~~~~~~~~~~

    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    ckendricks7@yahoo.com wrote:
    > I have a form that pulls up individual client records utilizing a
    > parameter query as it's Record Source. I want to open a MsgBox if more
    > than one client record is returned. I know that I can use the DCount
    > function and a field from the returned data (like the primary key) to
    > somehow trigger a MsgBox, but I just can't seem to get it to work.
    >
     
  4. charles.kendricks@charter.net

    Guest

    I tried attaching this bit of code to the OnOpen event and also to the
    OnLoad event of the form and neither worked ???
     
  5. strive4peace

    strive4peace
    Expand Collapse
    Guest

    Hi Charles,

    the code should go OnLoad...

    remember, the conditions are such that you only see a
    message if MORE than one record is returned...

    try this for testing...

    '~~~~~~~~~~~~~~
    Private Sub Form_Load()
    If Me.Recordset.RecordCount > 1 Then
    MsgBox Me.Recordset.RecordCount _
    & " records were returned" _
    , , "RecordCount"
    Else
    MsgBox "one record was returned" _
    , , "One record"
    End If
    End Sub
    '~~~~~~~~~~~~~~`

    Warm Regards,
    Crystal
    Microsoft Access MVP 2006

    *
    Have an awesome day ;)

    remote programming and training
    strive4peace2006 at yahoo.com

    *

    charles.kendricks@charter.net wrote:
    > I tried attaching this bit of code to the OnOpen event and also to the
    > OnLoad event of the form and neither worked ???
    >
     

Share This Page