[AccessD] Select Multiple records on form

Mark A Matte markamatte at hotmail.com
Mon May 15 10:41:39 CDT 2006


In stepping through the code and watching the screen change with each line 
of code I isolated the quirk I had noticed Friday.  When you execute the 
line "With .Add(acExpression, , Cdn)"...the control it is on turns gray for 
about 3 seconds and then changes back...before the next line is executed.  
What would cause this?  The same thing happens as the next 2 lines are 
executed.

Thanks,

Mark


>From: "Mark A Matte" <markamatte at hotmail.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: accessd at databaseadvisors.com
>Subject: Re: [AccessD] Select Multiple records on form
>Date: Fri, 12 May 2006 20:13:02 +0000
>
>A.D.,
>
>Thank you very much for the code.  It is acting strange...I think...If I
>click or navigate to a record...all other records are 'grayed' out...and 
>the
>single row is highlighted for about 3 seconds...then the screen is back to
>normal.
>
>I think I'm in the right direction...I just need to select more than
>one(non-sequential), have them stay selected, and do something with the 
>ones
>selected.
>
>Thanks,
>
>Mark
>
> >From: "A.D.TEJPAL" <adtp at hotmail.com>
> >Reply-To: Access Developers discussion and problem
> >solving<accessd at databaseadvisors.com>
> >To: "Access Developers discussion and problem
> >solving"<accessd at databaseadvisors.com>
> >CC: ADT <adtp at airtelbroadband.in>
> >Subject: Re: [AccessD] Select Multiple records on form
> >Date: Sat, 13 May 2006 00:09:27 +0530
> >
> >Mark,
> >
> >     On a continuous form, so long as record selectors are available, you
> >can pick up the selection via form's click event and then apply dynamic
> >conditional formatting so as to highlight only the records covered by
> >current selection. Form's SelTop & SelHeight properties are handy in this
> >context.
> >
> >     Sample code as given below, will ensure that all records currently
> >selected by the user get distinctly highlighted across the full row.
> >
> >     Note - The performance of conditional formatting in Access 2003 is
> >found to be better than that in Access 2000 (Access 2000 file format in
> >both cases).
> >
> >Best wishes,
> >A.D.Tejpal
> >---------------
> >
> >Code in module of continuous form
> >(ID is the name of primary key field)
> >=========================================
> >Private Sub Form_Click()
> >     P_SetFormat_A
> >End Sub
> >----------------------------------------------------------------------------
> >Private Sub Form_Current()
> >     P_SetFormat_A
> >End Sub
> >----------------------------------------------------------------------------
> >Private Function Fn_SelectedBlock(ByVal PkNumber _
> >                                                         As Long) As Long
> >     ' Returns 1 if the record with this PkNumber
> >     ' falls in selected block, otherwise 0
> >     Dim rst As DAO.Recordset
> >     Dim RecNum As Long, InSelection As Long
> >
> >     InSelection = 0  ' Default
> >     Set rst = Me.RecordsetClone
> >     rst.FindFirst "ID = " & PkNumber
> >     If Not rst.NoMatch Then
> >         RecNum = rst.AbsolutePosition + 1
> >         If RecNum >= Me.SelTop And _
> >                                 RecNum <= Me.SelTop + _
> >                                 (Me.SelHeight - 1) Then
> >             InSelection = 1
> >         End If
> >     End If
> >
> >     Fn_SelectedBlock = InSelection
> >
> >     rst.Close
> >     Set rst = Nothing
> >End Function
> >----------------------------------------------------------------------------
> >Public Sub P_SetFormat_A()
> >     ' Sets fresh Conditional Formatting in Detail section
> >     Dim ct As Control
> >
> >     For Each ct In Me.Detail.Controls
> >         P_SetFormat_B ct.Name
> >     Next
> >
> >     Me.Repaint
> >End Sub
> >----------------------------------------------------------------------------
> >Private Sub P_SetFormat_B(ByVal ControlName As String)
> >' Sets fresh Conditional Formatting
> >' (in text box named ControlName)
> >     Dim Cdn As String
> >
> >     On Error Resume Next    ' For controls not suited to
> >                                            ' conditional formatting
> >     With Me(ControlName).FormatConditions
> >         .Delete
> >
> >         Cdn = "Fn_SelectedBlock(ID) <> 0"
> >         With .Add(acExpression, , Cdn)
> >             .BackColor = 16777164
> >             .FontBold = True
> >         End With
> >     End With
> >     On Error GoTo 0
> >End Sub
> >=========================================
> >
> >   ----- Original Message -----
> >   From: Mark A Matte
> >   To: accessd at databaseadvisors.com
> >   Sent: Friday, May 12, 2006 21:41
> >   Subject: [AccessD] Select Multiple records on form
> >
> >
> >   Hello All,
> >
> >   I'm probably missing something simple here...but...I have a continuous
> >form
> >   in A2K using a NON-updateable recordset.  I would like the user to be
> >able
> >   to select multiple records...and then click a button to do some other
> >stuff.
> >
> >   My issue is how to select multiple records on this form...I'm thinking
> >some
> >   sort of conditional formatting...but not sure.  Any
> >   ideas/suggestions/direction?
> >
> >   Thanks,
> >
> >   Mark A. Matte
> >--
> >AccessD mailing list
> >AccessD at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/accessd
> >Website: http://www.databaseadvisors.com
>
>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com





More information about the AccessD mailing list