[AccessD] DataGrid control (cont.)

Stuart McLachlan stuart at lexacorp.com.pg
Sun Feb 19 18:23:09 CST 2012


Can't help with your query.

But out of curiosity,  why are you using a datagrid in preference to a subform in datasheet 
view?  

-- 
Stuart

On 20 Feb 2012 at 13:03, Stephen Bond wrote:

> Here's the whole Sub if that helps:
> ================================================
> Sub FillGridSpecificJobObservations(ByVal pk)
> Dim strSQL As String
>   Set rs = New ADOdb.Recordset
>   Set rs.ActiveConnection = CurrentProject.Connection
>   rs.CursorType = adOpenStatic
>   rs.LockType = adLockReadOnly
>   rs.CursorLocation = adUseClient
>   strSQL = "SELECT qryEquipmentRegisterRHS.JobId, " & _
>                    "qryEquipmentRegisterRHS.ObservationId AS ObsId, " &
> _
>                    "qryEquipmentRegisterRHS.ObserverName AS ObservName,
> " & _
>                    "qryEquipmentRegisterRHS.ObserverDate AS ObservDate,
> " & _
>                    "qryEquipmentRegisterRHS.ObserverTime AS ObsTime, " &
> _
>                    "qryEquipmentRegisterRHS.Shift, " & _
>                    "qryEquipmentRegisterRHS.Id"
>   strSQL = strSQL & " FROM qryEquipmentRegisterRHS "
>   strSQL = strSQL & " WHERE qryEquipmentRegisterRHS.JobId = " & pk & ";"
>   rs.Open strSQL
>   rs.Sort = "ObsId Asc"
>   SortAsc = True
>   Set Me.DataGridSpecificJobObservations.DataSource = rs   '  <---
> runtime error on this line
>   
>   Me.DataGridSpecificJobObservations.Refresh
>   
>   Set dg = Me.DataGridSpecificJobObservations
>   dg.Font.Size = 8
>   dg.RecordSelectors = False
>   dg.Columns(0).Width = 0     ' JobId
>   dg.Columns(1).Width = 500   ' ObservationId
>   dg.Columns(2).Width = 1800  ' Name
>   dg.Columns(3).Width = 1000  ' Date
>   dg.Columns(4).Width = 800   ' Time
>   dg.Columns(5).Width = 450   ' Shift (was S or U)
>   dg.Columns(6).Width = 0     ' Id
>  ' dg.Columns(5).NumberFormat = "currency"
>   dg.Columns(3).NumberFormat = "dd/mm/yyyy"
>   dg.Columns(4).NumberFormat = "hh:nn"
>   dg.Columns(3).Alignment = 2
>   dg.Columns(4).Alignment = 2
>   dg.Columns(5).Alignment = 2
>   dg.MarqueeStyle = 3
>   If rs.RecordCount = 0 Then
>  '   Me.Toolbar1.Buttons("Edit").Enabled = False
>   Else
>   '  Me.Toolbar1.Buttons("Edit").Enabled = True
>   End If
> End Sub
> 
> =================================
> 
> -- 
> 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