[AccessD] callback Constant acLBGetFormat

Gustav Brock gustav at cactus.dk
Wed Jul 23 05:05:42 CDT 2003


Hi David

> Does anyone know how to use the intrinsic Constant "acLBGetFormat"?

You use it to apply a format string to the items.

Here's an example:

<code>

Public Function ListDayInWeeks( _
  ctl As Control, _
  lngID As Long, _
  lngRow As Long, _
  lngCol As Long, _
  intCode As Integer) As Variant

  ' Choose day of week to display.
  Const cbytDayInWeek As Byte = vbFriday
  
  Static datFirstDate As Date
  Static strFormat As String
  
  Select Case intCode
    Case acLBInitialize
      datFirstDate = DateAdd("d", 8 - WeekDay(Date, cbytDayInWeek), Date)
      strFormat = ctl.Format
      ListDayInWeeks = True       ' True to initialize.
    Case acLBOpen
      ListDayInWeeks = Timer      ' Autogenerated unique ID.
    Case acLBGetRowCount          ' Get rows.
      ListDayInWeeks = 12         ' Set number of rows.
    Case acLBGetColumnCount       ' Get columns.
      ListDayInWeeks = 1          ' Set number of columns.
    Case acLBGetColumnWidth       ' Get column width.
      ListDayInWeeks = -1         ' Use default width.
    Case acLBGetValue             ' Get the data.
      ListDayInWeeks = DateAdd("ww", lngRow, datFirstDate)
    Case acLBGetFormat            ' Format the data.
      ListDayInWeeks = strFormat  ' Use format of control.
    Case acLBEnd
      ' Do something when form with listbox closes or
      ' listbox is requeried.
  End Select

End Function

</code>

/gustav



More information about the AccessD mailing list